Package anlavn.net
Class DocNet
java.lang.Object
anlavn.net.DocNet
The DocNet class supports to read an online document from URL.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal long
getSize()
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
readLine()
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
saveAs()
Use this method to save the file to your computer.final void
Use this method to save the file to your computer.
-
Constructor Details
-
DocNet
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
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
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
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
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
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.
-