Package anlavn.net

Class DocNet

java.lang.Object
anlavn.net.DocNet

public class DocNet extends Object
The DocNet class supports to read an online document from URL.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an online document from URL.
  • Method Summary

    Modifier and Type
    Method
    Description
    final long
    Use this method to get the number of bytes of the link.
    final String
    Use this method to read all line of text.
    final String
    Use this method to reads a line of text.
    A line is considered to be terminated by '\n', '\r', a carriage return followed or by reaching the end-of-file.
    final void
    Use this method to save the file to your computer.
    final void
    saveAs(String filePath)
    Use this method to save the file to your computer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DocNet

      public DocNet(String URL) throws IOException
      Create an online document from URL.
      Parameters:
      URL - is the link to your online document.
      Throws:
      IOException - throw exception if there is an error like no internet connection, malformed URL or the document does not exist.
  • Method Details

    • getSize

      public final long getSize() throws IOException
      Use this method to get the number of bytes of the link.
      Returns:
      number of bytes of the link.
      Throws:
      IOException - throw exception if there is an error like no internet connection or the document does not exist.
    • readLine

      public final String readLine() throws IOException
      Use this method to reads a line of text.
      A line is considered to be terminated by '\n', '\r', a carriage return followed or by reaching the end-of-file.
      Returns:
      A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached without reading any characters.
      Throws:
      IOException - throw exception if there is an error like no internet connection or the document does not exist.
    • readAllLine

      public final String readAllLine() throws IOException
      Use this method to read all line of text.
      Returns:
      A String containing the content of online document.
      Throws:
      IOException - throw exception if there is an error like no internet connection or the document does not exist.
    • saveAs

      public final void saveAs() throws IOException
      Use this method to save the file to your computer.
      Throws:
      IOException - throw exception if there is an error like no internet connection or the document does not exist.
    • saveAs

      public final void saveAs(String filePath) throws IOException
      Use this method to save the file to your computer.
      Parameters:
      filePath - is the file path you want to save the file.
      Throws:
      IOException - throw exception if there is an error like no internet connection or the document does not exist.