java.lang.Object
java.io.RandomAccessFile
com.aoapps.hodgepodge.io.FixedRecordFile
- All Implemented Interfaces:
Closeable
,DataInput
,DataOutput
,AutoCloseable
A way to more easily manipulate files with fixed-record-size rows.
- Author:
- AO Industries, Inc.
-
Constructor Summary
ConstructorDescriptionFixedRecordFile
(File file, String mode, int recordLength) FixedRecordFile
(String name, String mode, int recordLength) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRecord
(int index) void
addRecords
(int index, int numRecords) static void
copyBytes
(RandomAccessFile from, long fromIndex, RandomAccessFile to, long toIndex, long numBytes) static void
copyRecords
(FixedRecordFile from, long fromIndex, FixedRecordFile to, long toIndex, long numRecords) int
int
void
void
removeRecord
(int index) void
seekToExistingRecord
(int index) void
swap
(int index1, int index2) Methods inherited from class java.io.RandomAccessFile
close, getChannel, getFD, getFilePointer, length, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setLength, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
Constructor Details
-
FixedRecordFile
- Throws:
FileNotFoundException
-
FixedRecordFile
- Throws:
FileNotFoundException
-
-
Method Details
-
seekToExistingRecord
- Throws:
IndexOutOfBoundsException
IOException
-
addRecord
- Throws:
IndexOutOfBoundsException
IOException
-
addRecords
- Throws:
IndexOutOfBoundsException
IOException
-
getRecordCount
- Throws:
IOException
-
copyBytes
public static void copyBytes(RandomAccessFile from, long fromIndex, RandomAccessFile to, long toIndex, long numBytes) throws IOException - Throws:
IOException
-
copyRecords
public static void copyRecords(FixedRecordFile from, long fromIndex, FixedRecordFile to, long toIndex, long numRecords) throws IOException - Throws:
IOException
-
removeAllRecords
- Throws:
IOException
-
removeRecord
- Throws:
IOException
-
getRecordLength
public int getRecordLength() -
swap
- Throws:
IOException
-