|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Reader
java.io.BufferedReader
org.knime.base.node.util.BufferedFileReader
public final class BufferedFileReader
A reader that counts the number of bytes read.
Nested Class Summary | |
---|---|
(package private) static class |
BufferedFileReader.ByteCountingStream
Wraps an input stream and counts the number of bytes read from the stream. |
Field Summary |
---|
Fields inherited from class java.io.Reader |
---|
lock |
Method Summary | |
---|---|
void |
close()
|
static BufferedFileReader |
createNewReader(InputStream in)
Same as the method above ( createNewReader(URL) ), but with an
input stream as argument. |
static BufferedFileReader |
createNewReader(URL dataLocation)
Creates a new reader from the specified location with the default character set from the Java VM. |
static BufferedFileReader |
createNewReader(URL dataLocation,
String charsetName)
Creates a new reader from the specified location with the default character set from the Java VM. |
protected void |
finalize()
|
String |
getCurrentLine()
Returns the line currently read (if the \n char was already read, it still returns the current/last line). |
long |
getCurrentLineNumber()
|
long |
getFileSize()
|
long |
getNumberOfBytesRead()
|
String |
getZipEntryName()
If the underlying source is a ZIP archive this method returns the name of the entry read. |
boolean |
hasMoreZipEntries()
|
boolean |
isZippedSource()
|
void |
mark(int readAheadLimit)
|
boolean |
markSupported()
|
int |
read()
|
int |
read(char[] cbuf,
int off,
int len)
|
String |
readLine()
|
boolean |
ready()
|
void |
reset()
|
long |
skip(long n)
|
Methods inherited from class java.io.Reader |
---|
read, read |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public long getNumberOfBytesRead()
public long getFileSize()
public String getCurrentLine() throws IOException
readLine()
this method doesn't modify the stream
(doesn't read from it!) and it returns the entire line (also the
characters at the beginning of the line if they were read already).
IOException
- if the stream has been closedpublic long getCurrentLineNumber() throws IOException
IOException
- if the stream has been closedpublic void close() throws IOException
close
in interface Closeable
close
in class BufferedReader
IOException
public void mark(int readAheadLimit) throws IOException
mark
in class BufferedReader
IOException
public boolean markSupported()
markSupported
in class BufferedReader
public int read() throws IOException
read
in class BufferedReader
IOException
public int read(char[] cbuf, int off, int len) throws IOException
read
in class BufferedReader
IOException
public String readLine() throws IOException
readLine
in class BufferedReader
IOException
public boolean ready() throws IOException
ready
in class BufferedReader
IOException
public void reset() throws IOException
reset
in class BufferedReader
IOException
public long skip(long n) throws IOException
skip
in class BufferedReader
IOException
public static BufferedFileReader createNewReader(URL dataLocation) throws IOException
getNumberOfBytesRead()
),
and, if the location specifies a local file - and the size of it can be
retrieved - the overall byte count in the stream
(getFileSize()
).getCurrentLine()
)and the current line number
(getCurrentLineNumber()
).
dataLocation
- the URL of the source to read from. If it is zipped
it will try to open a ZIP stream on it.
IOException
- if something went wrong when opening the stream.public static BufferedFileReader createNewReader(URL dataLocation, String charsetName) throws IOException
getNumberOfBytesRead()
),
and, if the location specifies a local file - and the size of it can be
retrieved - the overall byte count in the stream
(getFileSize()
).getCurrentLine()
)and the current line number
(getCurrentLineNumber()
).
dataLocation
- the URL of the source to read from. If it is zipped
it will try to open a ZIP stream on it.charsetName
- the character set to use. Must be supported by the VM
IOException
- if something went wrong when opening the stream.
IllegalCharsetNameException
- If the given charset
name is illegal
UnsupportedCharsetException
- If no support for
the named charset is available in this instance of the Java
virtual machinepublic static BufferedFileReader createNewReader(InputStream in)
createNewReader(URL)
), but with an
input stream as argument. The getFileSize()
method of the
created reader always returns zero.
in
- the stream to read from
BufferedReader
), but no file size (even if the
stream reads from a file).public String getZipEntryName()
public boolean isZippedSource()
public boolean hasMoreZipEntries()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |