public class RandomAccessFiles
extends java.lang.Object
RandomAccessFile
.Constructor and Description |
---|
RandomAccessFiles() |
Modifier and Type | Method and Description |
---|---|
static boolean |
contentEquals(java.io.RandomAccessFile raf1,
java.io.RandomAccessFile raf2)
Tests if two RandomAccessFile contents are equal.
|
private static long |
length(java.io.RandomAccessFile raf) |
static byte[] |
read(java.io.RandomAccessFile input,
long position,
int length)
Reads a byte array starting at "position" for "length" bytes.
|
static java.io.RandomAccessFile |
reset(java.io.RandomAccessFile raf)
Resets the given file to position 0.
|
public static boolean contentEquals(java.io.RandomAccessFile raf1, java.io.RandomAccessFile raf2) throws java.io.IOException
raf1
- A RandomAccessFile.raf2
- Another RandomAccessFile.java.io.IOException
- if an I/O error occurs.private static long length(java.io.RandomAccessFile raf) throws java.io.IOException
java.io.IOException
public static byte[] read(java.io.RandomAccessFile input, long position, int length) throws java.io.IOException
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.java.io.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.public static java.io.RandomAccessFile reset(java.io.RandomAccessFile raf) throws java.io.IOException
raf
- The RandomAccessFile to reset.java.io.IOException
- If pos
is less than 0
or if an I/O error occurs.