class HttpRandomAccessContent<FS extends HttpFileSystem> extends AbstractRandomAccessStreamContent
Modifier and Type | Field and Description |
---|---|
private java.io.DataInputStream |
dis |
private HttpFileObject<FS> |
fileObject |
protected long |
filePointer |
private HttpFileSystem |
fileSystem |
private MonitorInputStream |
mis |
Constructor and Description |
---|
HttpRandomAccessContent(HttpFileObject<FS> fileObject,
RandomAccessMode mode) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this random access file stream and releases any system resources associated with the stream.
|
protected java.io.DataInputStream |
getDataInputStream() |
long |
getFilePointer()
Returns the current offset in this file.
|
long |
length()
Returns the length of this file.
|
void |
seek(long pos)
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.
|
getInputStream, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setLength, skipBytes
readLine, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
protected long filePointer
private final HttpFileObject<FS extends HttpFileSystem> fileObject
private final HttpFileSystem fileSystem
private java.io.DataInputStream dis
private MonitorInputStream mis
HttpRandomAccessContent(HttpFileObject<FS> fileObject, RandomAccessMode mode)
public long getFilePointer() throws java.io.IOException
RandomAccessContent
java.io.IOException
- if an I/O error occurs.public void seek(long pos) throws java.io.IOException
RandomAccessContent
The offset may be set beyond the end of the file. Setting the offset beyond the end of the file does not change the file length. The file length will change only by writing after the offset has been set beyond the end of the file.
Notice: If you use RandomAccessContent.getInputStream()
you have to re-get the InputStream after calling
RandomAccessContent.seek(long)
pos
- the offset position, measured in bytes from the beginning of the file, at which to set the file
pointer.java.io.IOException
- if pos
is less than 0
or if an I/O error occurs.protected java.io.DataInputStream getDataInputStream() throws java.io.IOException
getDataInputStream
in class AbstractRandomAccessStreamContent
java.io.IOException
public void close() throws java.io.IOException
RandomAccessContent
A closed random access file cannot perform input or output operations and cannot be reopened.
If this file has an associated channel then the channel is closed as well.
java.io.IOException
- if an I/O error occurs.public long length() throws java.io.IOException
RandomAccessContent
java.io.IOException
- if an I/O error occurs.