private static final class Tailer.RandomAccessFileBridge extends java.lang.Object implements Tailer.RandomAccessResourceBridge
RandomAccessFile
.Modifier and Type | Field and Description |
---|---|
private java.io.RandomAccessFile |
randomAccessFile |
Modifier | Constructor and Description |
---|---|
private |
RandomAccessFileBridge(java.io.File file,
java.lang.String mode) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
getPointer()
Gets the current offset in this tailable.
|
int |
read(byte[] b)
Reads up to
b.length bytes of data from this tailable into an array of bytes. |
void |
seek(long position)
Sets the file-pointer offset, measured from the beginning of this tailable, at which the next read or write occurs.
|
private RandomAccessFileBridge(java.io.File file, java.lang.String mode) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public long getPointer() throws java.io.IOException
Tailer.RandomAccessResourceBridge
getPointer
in interface Tailer.RandomAccessResourceBridge
java.io.IOException
- if an I/O error occurs.public int read(byte[] b) throws java.io.IOException
Tailer.RandomAccessResourceBridge
b.length
bytes of data from this tailable into an array of bytes. This method blocks until at
least one byte of input is available.read
in interface Tailer.RandomAccessResourceBridge
b
- the buffer into which the data is read.-1
if there is no more data because the end of
this tailable has been reached.java.io.IOException
- If the first byte cannot be read for any reason other than end of tailable, or if the random
access tailable has been closed, or if some other I/O error occurs.public void seek(long position) throws java.io.IOException
Tailer.RandomAccessResourceBridge
seek
in interface Tailer.RandomAccessResourceBridge
position
- the offset position, measured in bytes from the beginning of the tailable, at which to set the tailable
pointer.java.io.IOException
- if pos
is less than 0
or if an I/O error occurs.