@NotThreadSafe public abstract class DisconnectingReadOnlyFile extends DecoratingReadOnlyFile
delegate| Modifier | Constructor and Description |
|---|---|
protected |
DisconnectingReadOnlyFile(ReadOnlyFile rof) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkOpen()
|
abstract void |
close()
Closes this read-only file and releases any non-heap resources
allocated for it.
|
long |
getFilePointer()
Returns the current byte position in the file as a zero-based index.
|
abstract boolean |
isOpen() |
long |
length()
Returns the length of the file in bytes.
|
int |
read()
Reads and returns the next byte or -1 if the end of the file has been
reached.
|
int |
read(byte[] b,
int off,
int len)
Reads up to
len bytes of data from this read only file into
the given array. |
void |
seek(long pos)
Sets the current byte position in the file as a zero-based index at
which the next read occurs.
|
toStringread, readFully, readFullyprotected DisconnectingReadOnlyFile(@Nullable ReadOnlyFile rof)
protected final void checkOpen()
throws InputClosedException
InputClosedException - iff isOpen() returns false.public abstract void close()
throws IOException
ReadOnlyFileclose in interface ReadOnlyFileclose in interface Closeableclose in interface AutoCloseableclose in class DecoratingReadOnlyFileIOException - On any I/O failure.public long getFilePointer()
throws IOException
ReadOnlyFilegetFilePointer in interface ReadOnlyFilegetFilePointer in class DecoratingReadOnlyFileIOException - On any I/O failure.public abstract boolean isOpen()
public long length()
throws IOException
ReadOnlyFilelength in interface ReadOnlyFilelength in class DecoratingReadOnlyFileIOException - On any I/O failure.public int read()
throws IOException
ReadOnlyFileread in interface ReadOnlyFileread in class DecoratingReadOnlyFileIOException - On any I/O failure.public int read(byte[] b,
int off,
int len)
throws IOException
ReadOnlyFilelen bytes of data from this read only file into
the given array.
This method blocks until at least one byte of input is available unless
len is zero.read in interface ReadOnlyFileread in class DecoratingReadOnlyFileb - The buffer to fill with data.off - The start offset of the data.len - The maximum number of bytes to read.-1 if there is
no more data because the end of the file has been reached.IOException - On any I/O failure.public void seek(long pos)
throws IOException
ReadOnlyFileDefaultReadOnlyFile
passes "r" as a parameter to the constructor of its super-class
RandomAccessFile.
With Oracle's JSE implementation, on the Windows platform this
implementation allows to seek past the end of file, but on the Linux
platform it doesn't.seek in interface ReadOnlyFileseek in class DecoratingReadOnlyFilepos - The current byte position as a zero-based index.IOException - If pos is less than 0 or on any
I/O failure.Copyright © 2005-2013 Schlichtherle IT Services. All Rights Reserved.