Class Http4RandomAccessContent<FS extends Http4FileSystem>
java.lang.Object
org.apache.commons.vfs2.provider.AbstractRandomAccessContent
org.apache.commons.vfs2.provider.AbstractRandomAccessStreamContent
org.apache.commons.vfs2.provider.http4.Http4RandomAccessContent<FS>
- All Implemented Interfaces:
Closeable, DataInput, DataOutput, AutoCloseable, RandomAccessContent
final class Http4RandomAccessContent<FS extends Http4FileSystem>
extends AbstractRandomAccessStreamContent
RandomAccess content using
Http4FileObject.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DataInputStreamprivate final Http4FileObject<FS> protected longprivate MonitorInputStream -
Constructor Summary
ConstructorsConstructorDescriptionHttp4RandomAccessContent(Http4FileObject<FS> fileObject, RandomAccessMode mode) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this random access file stream and releases any system resources associated with the stream.protected DataInputStreamlongReturns the current offset in this file.longlength()Returns the length of this file.voidseek(long pos) Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.Methods inherited from class AbstractRandomAccessStreamContent
getInputStream, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setLength, skipBytesMethods inherited from class AbstractRandomAccessContent
readLine, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
Field Details
-
filePointer
protected long filePointer -
fileObject
-
dataInputStream
-
monitorInputStream
-
-
Constructor Details
-
Http4RandomAccessContent
Http4RandomAccessContent(Http4FileObject<FS> fileObject, RandomAccessMode mode)
-
-
Method Details
-
close
Description copied from interface:RandomAccessContentCloses this random access file stream and releases any system resources associated with the stream.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.
- Throws:
IOException- if an I/O error occurs.
-
getDataInputStream
- Specified by:
getDataInputStreamin classAbstractRandomAccessStreamContent- Throws:
IOException
-
getFilePointer
Description copied from interface:RandomAccessContentReturns the current offset in this file.- Returns:
- the offset from the beginning of the file, in bytes, at which the next read or write occurs.
- Throws:
IOException- if an I/O error occurs.
-
length
Description copied from interface:RandomAccessContentReturns the length of this file.- Returns:
- the length of this file, measured in bytes.
- Throws:
IOException- if an I/O error occurs.
-
seek
Description copied from interface:RandomAccessContentSets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.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 callingRandomAccessContent.seek(long)- Parameters:
pos- the offset position, measured in bytes from the beginning of the file, at which to set the file pointer.- Throws:
IOException- ifposis less than0or if an I/O error occurs.
-