Package org.apache.commons.io
Class RandomAccessFiles
java.lang.Object
org.apache.commons.io.RandomAccessFiles
Works with 
RandomAccessFile.- Since:
- 2.13.0
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleancontentEquals(RandomAccessFile raf1, RandomAccessFile raf2) Tests if two RandomAccessFile contents are equal.static byte[]read(RandomAccessFile input, long position, int length) Reads a byte array starting at "position" for "length" bytes.static RandomAccessFilereset(RandomAccessFile raf) Resets the given file to position 0.
- 
Constructor Details- 
RandomAccessFilesDeprecated.TODO Make private in 3.0.Make private in 3.0.
 
- 
- 
Method Details- 
contentEqualspublic static boolean contentEquals(RandomAccessFile raf1, RandomAccessFile raf2) throws IOException Tests if two RandomAccessFile contents are equal.- Parameters:
- raf1- A RandomAccessFile.
- raf2- Another RandomAccessFile.
- Returns:
- true if the contents of both RandomAccessFiles are equal, false otherwise.
- Throws:
- IOException- if an I/O error occurs.
- Since:
- 2.15.0
 
- 
readReads a byte array starting at "position" for "length" bytes.- Parameters:
- input- The source RandomAccessFile.
- position- The offset position, measured in bytes from the beginning of the file, at which to set the file pointer.
- length- How many bytes to read.
- Returns:
- a new byte array.
- Throws:
- IOException- If the first byte cannot be read for any reason other than end of file, or if the random access file has been closed, or if some other I/O error occurs.
 
- 
resetResets the given file to position 0.- Parameters:
- raf- The RandomAccessFile to reset.
- Returns:
- The given RandomAccessFile.
- Throws:
- IOException- If- posis less than- 0or if an I/O error occurs.
- Since:
- 2.15.0
 
 
-