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
ConstructorsConstructorDescriptionFixedRecordFile(File file, String mode, int recordLength) FixedRecordFile(String name, String mode, int recordLength) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRecord(int index) voidaddRecords(int index, int numRecords) static voidcopyBytes(RandomAccessFile from, long fromIndex, RandomAccessFile to, long toIndex, long numBytes) static voidcopyRecords(FixedRecordFile from, long fromIndex, FixedRecordFile to, long toIndex, long numRecords) intintvoidvoidremoveRecord(int index) voidseekToExistingRecord(int index) voidswap(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:
IndexOutOfBoundsExceptionIOException
-
addRecord
- Throws:
IndexOutOfBoundsExceptionIOException
-
addRecords
- Throws:
IndexOutOfBoundsExceptionIOException
-
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
-
