Interface RandomAccessContent
- All Superinterfaces:
- AutoCloseable,- Closeable,- DataInput,- DataOutput
- All Known Implementing Classes:
- AbstractRandomAccessContent,- AbstractRandomAccessStreamContent,- MonitorRandomAccessContent,- RamFileRandomAccessContent
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Closes this random access file stream and releases any system resources associated with the stream.longReturns the current offset in this file.Gets the input stream.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.voidsetLength(long newLength) Sets the length of this content.Methods inherited from interface java.io.DataInputreadBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytesMethods inherited from interface java.io.DataOutputwrite, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
- 
Method Details- 
closeCloses 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. - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException- if an I/O error occurs.
 
- 
getFilePointerReturns 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.
 
- 
getInputStreamGets the input stream.Notice: If you use seek(long)you have to re-get the InputStream- Returns:
- the InputStream.
- Throws:
- IOException- if an I/O error occurs.
 
- 
lengthReturns the length of this file.- Returns:
- the length of this file, measured in bytes.
- Throws:
- IOException- if an I/O error occurs.
 
- 
seekSets 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 getInputStream()you have to re-get the InputStream after callingseek(long)- Parameters:
- pos- the offset position, measured in bytes from the beginning of the file, at which to set the file pointer.
- Throws:
- IOException- if- posis less than- 0or if an I/O error occurs.
 
- 
setLengthSets the length of this content.If the newLengthargument is smaller thanlength(), the content is truncated.If the newLengthargument is greater thanlength(), the content grows with undefined data.- Parameters:
- newLength- The desired content length
- Throws:
- IOException- If an I/O error occurs
- Since:
- 2.1
 
 
-