Interface RandomAccessToFile
- All Known Implementing Classes:
RandomAccessFilePaged,RandomAccessFileRAF
public interface RandomAccessToFile
random access file abstraction
- Author:
- juergen
-
Method Summary
Modifier and TypeMethodDescriptionbooleancheckFile(long offset, int len) check file contentsvoidclose()close filevoiddelete()voidflush()flush filelongget the current position of the filelonglength()Get the file lengthvoidread(byte[] bytes) Reads a byte array from current position.voidread(byte[] bytes, int offset, int len) bytereadByte()Reads a byte from current position.intreadInt()Reads an int at current position.longreadLong()Reads a long at current position.voidseek(long position) Positions to an addressvoidwrite(byte[] bytes) Writes a byte array to current position.voidwrite(byte[] bytes, int start, int len) Writes len bytes from byte array from start position to current position.voidwriteByte(int b) Reads a byte current positionvoidwriteInt(int value) Writes an int to current position.voidwriteLong(long value) Writes a long to current position.
-
Method Details
-
seek
Positions to an address- Parameters:
position-- Throws:
IOException
-
read
Reads a byte array from current position. Creates an exception if byte array crosses a page border- Parameters:
bytes-- Throws:
IOException
-
readByte
Reads a byte from current position.- Parameters:
b-- Throws:
IOException
-
writeByte
Reads a byte current position- Parameters:
b-- Throws:
IOException
-
write
Writes a byte array to current position. Creates an exception if byte array crosses a page border- Parameters:
bytes-- Throws:
IOException
-
write
Writes len bytes from byte array from start position to current position. Creates an exception if byte array crosses a page border- Parameters:
bytes-- Throws:
IOException
-
readInt
Reads an int at current position. Creates an exception if byte array crosses a page border- Throws:
IOException
-
writeInt
Writes an int to current position. Creates an exception if byte array crosses a page border- Parameters:
value-- Throws:
IOException
-
close
close file- Throws:
IOException
-
flush
flush file- Throws:
IOException
-
readLong
Reads a long at current position. Creates an exception if byte array crosses a page border- Throws:
IOException
-
writeLong
Writes a long to current position. Creates an exception if byte array crosses a page border- Throws:
IOException
-
length
Get the file length- Throws:
IOException
-
read
- Parameters:
bytes-offset-len-- Throws:
IOException
-
delete
- Throws:
IOException
-
getFilePointer
get the current position of the file- Returns:
- Throws:
IOException
-
checkFile
check file contents- Parameters:
offset-len-- Returns:
- Throws:
IOException
-