Interface RandomAccessToFile
- All Known Implementing Classes:
RandomAccessFilePaged
,RandomAccessFileRAF
public interface RandomAccessToFile
random access file abstraction
- Author:
- juergen
-
Method Summary
Modifier and TypeMethodDescriptionboolean
checkFile
(long offset, int len) check file contentsvoid
close()
close filevoid
delete()
void
flush()
flush filelong
get the current position of the filelong
length()
Get the file lengthvoid
read
(byte[] bytes) Reads a byte array from current position.void
read
(byte[] bytes, int offset, int len) byte
readByte()
Reads a byte from current position.int
readInt()
Reads an int at current position.long
readLong()
Reads a long at current position.void
seek
(long position) Positions to an addressvoid
write
(byte[] bytes) Writes a byte array to current position.void
write
(byte[] bytes, int start, int len) Writes len bytes from byte array from start position to current position.void
writeByte
(int b) Reads a byte current positionvoid
writeInt
(int value) Writes an int to current position.void
writeLong
(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
-