static class SaxReaderImpl.FileInputStreamWrapper
extends java.io.InputStream
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
fileName
File name.
|
private boolean |
isStarted
Lazy initialization flag.
|
private long |
mark
The marked position in the stream.
|
private Stream |
stream
Buffered input Stream.
|
| Constructor and Description |
|---|
FileInputStreamWrapper(java.lang.String source)
Constructor accepting a file name, which will read after first call.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Obtains an estimate of the number of bytes that can be read from this stream without blocking.
|
void |
close()
Close input stream.
|
private void |
init(boolean canWrite)
Initialization method which creates stream wrapper.
|
void |
mark(int readlimit)
Mark the current position in the stream.
|
boolean |
markSupported()
Tests if this stream supports the mark mode.
|
int |
read()
Reads the next byte of data from the input stream.
|
int |
read(byte[] array,
int off,
int len)
Read a chunk of bytes from the current read position in the stream to the
offset calculated by given length or to the
EOF, whichever
comes first. |
void |
reset()
Resets the input stream to begin reading from the first character
of this input stream's underlying buffer.
|
private final java.lang.String fileName
private volatile boolean isStarted
private Stream stream
private long mark
FileInputStreamWrapper(java.lang.String source)
source - A file name.public int read()
throws java.io.IOException
int in the range 0 to
255. If no byte is available because the end of the stream
has been reached, the value -1 is returned.read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] array,
int off,
int len)
throws java.io.IOException
EOF, whichever
comes first. The EOF character is not returned.read in class java.io.InputStreamarray - The array in which to save bytes.off - The offset into the array at which to start saving bytes.len - The maximum number of bytes to read.EOF has been
reached). The number of bytes read will be the smaller
of the len parameter or the actual bytes left
before the EOF.java.io.IOException - If an I/O error occurs.public int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOExceptionpublic void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOExceptionpublic void mark(int readlimit)
mark in class java.io.InputStreamreadlimit - This argument is not used.public boolean markSupported()
markSupported in class java.io.InputStreamtrue.private void init(boolean canWrite)
throws java.io.IOException
canWrite - if true than file will open in read/write mode, otherwise only in
read mode.java.io.IOException - In case of I/O errors.public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOException