Package net.metanotion.io
Class RAIFile
java.lang.Object
net.metanotion.io.RAIFile
- All Implemented Interfaces:
Closeable
,DataInput
,DataOutput
,AutoCloseable
,RandomAccessInterface
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canWrite()
I2P is the file writable? Only valid if the File constructor was used, not the RAF constructorvoid
close()
long
long
length()
int
read()
int
read
(byte[] b) int
read
(byte[] b, int off, int len) boolean
byte
readByte()
char
readChar()
double
float
void
readFully
(byte[] b) void
readFully
(byte[] b, int off, int len) int
readInt()
readLine()
long
readLong()
short
int
int
I2Pint
readUTF()
Read a UTF encoded string I would delegate here.void
seek
(long pos) void
setLength
(long newLength) int
skipBytes
(int n) toString()
void
write
(byte[] b) void
write
(byte[] b, int off, int len) void
write
(int b) void
writeBoolean
(boolean v) void
writeByte
(int v) void
writeBytes
(String s) void
writeChar
(int v) void
writeChars
(String s) void
writeDouble
(double v) void
writeFloat
(float v) void
writeInt
(int v) void
writeLong
(long v) void
writeShort
(int v) void
Write a UTF encoded string I would delegate here.
-
Constructor Details
-
RAIFile
- Throws:
FileNotFoundException
-
RAIFile
- Parameters:
read
- must be true- Throws:
FileNotFoundException
-
-
Method Details
-
canWrite
public boolean canWrite()I2P is the file writable? Only valid if the File constructor was used, not the RAF constructor- Specified by:
canWrite
in interfaceRandomAccessInterface
- Since:
- 0.8.8
-
toString
-
getFilePointer
- Specified by:
getFilePointer
in interfaceRandomAccessInterface
- Throws:
IOException
-
length
- Specified by:
length
in interfaceRandomAccessInterface
- Throws:
IOException
-
read
- Specified by:
read
in interfaceRandomAccessInterface
- Throws:
IOException
-
read
- Specified by:
read
in interfaceRandomAccessInterface
- Throws:
IOException
-
read
- Specified by:
read
in interfaceRandomAccessInterface
- Throws:
IOException
-
seek
- Specified by:
seek
in interfaceRandomAccessInterface
- Throws:
IOException
-
setLength
- Specified by:
setLength
in interfaceRandomAccessInterface
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceRandomAccessInterface
- Throws:
IOException
-
readBoolean
- Specified by:
readBoolean
in interfaceDataInput
- Specified by:
readBoolean
in interfaceRandomAccessInterface
- Throws:
IOException
-
readByte
- Specified by:
readByte
in interfaceDataInput
- Specified by:
readByte
in interfaceRandomAccessInterface
- Throws:
IOException
-
readChar
- Specified by:
readChar
in interfaceDataInput
- Specified by:
readChar
in interfaceRandomAccessInterface
- Throws:
IOException
-
readDouble
- Specified by:
readDouble
in interfaceDataInput
- Specified by:
readDouble
in interfaceRandomAccessInterface
- Throws:
IOException
-
readFloat
- Specified by:
readFloat
in interfaceDataInput
- Specified by:
readFloat
in interfaceRandomAccessInterface
- Throws:
IOException
-
readFully
- Specified by:
readFully
in interfaceDataInput
- Specified by:
readFully
in interfaceRandomAccessInterface
- Throws:
IOException
-
readFully
- Specified by:
readFully
in interfaceDataInput
- Specified by:
readFully
in interfaceRandomAccessInterface
- Throws:
IOException
-
readInt
- Specified by:
readInt
in interfaceDataInput
- Specified by:
readInt
in interfaceRandomAccessInterface
- Throws:
IOException
-
readLine
- Specified by:
readLine
in interfaceDataInput
- Specified by:
readLine
in interfaceRandomAccessInterface
- Throws:
IOException
-
readLong
- Specified by:
readLong
in interfaceDataInput
- Specified by:
readLong
in interfaceRandomAccessInterface
- Throws:
IOException
-
readShort
- Specified by:
readShort
in interfaceDataInput
- Specified by:
readShort
in interfaceRandomAccessInterface
- Throws:
IOException
-
readUnsignedByte
- Specified by:
readUnsignedByte
in interfaceDataInput
- Specified by:
readUnsignedByte
in interfaceRandomAccessInterface
- Throws:
IOException
-
readUnsignedShort
- Specified by:
readUnsignedShort
in interfaceDataInput
- Specified by:
readUnsignedShort
in interfaceRandomAccessInterface
- Throws:
IOException
-
readUnsignedInt
I2P- Specified by:
readUnsignedInt
in interfaceRandomAccessInterface
- Throws:
IOException
- if the read value is negative
-
readUTF
Read a UTF encoded string I would delegate here. But Java's read/writeUTF combo suck. A signed 2 byte length is not enough. This reads a 4 byte length. The upper byte MUST be zero, if its not, then its not this method and has used an extensible length encoding. This is followed by the bytes of the UTF encoded string, as returned by String.getBytes("UTF-8");- Specified by:
readUTF
in interfaceDataInput
- Specified by:
readUTF
in interfaceRandomAccessInterface
- Throws:
IOException
-
skipBytes
- Specified by:
skipBytes
in interfaceDataInput
- Specified by:
skipBytes
in interfaceRandomAccessInterface
- Throws:
IOException
-
write
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceRandomAccessInterface
- Throws:
IOException
-
write
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceRandomAccessInterface
- Throws:
IOException
-
write
- Specified by:
write
in interfaceDataOutput
- Specified by:
write
in interfaceRandomAccessInterface
- Throws:
IOException
-
writeBoolean
- Specified by:
writeBoolean
in interfaceDataOutput
- Specified by:
writeBoolean
in interfaceRandomAccessInterface
- Throws:
IOException
-
writeByte
- Specified by:
writeByte
in interfaceDataOutput
- Specified by:
writeByte
in interfaceRandomAccessInterface
- Throws:
IOException
-
writeShort
- Specified by:
writeShort
in interfaceDataOutput
- Specified by:
writeShort
in interfaceRandomAccessInterface
- Throws:
IOException
-
writeChar
- Specified by:
writeChar
in interfaceDataOutput
- Specified by:
writeChar
in interfaceRandomAccessInterface
- Throws:
IOException
-
writeInt
- Specified by:
writeInt
in interfaceDataOutput
- Specified by:
writeInt
in interfaceRandomAccessInterface
- Throws:
IOException
-
writeLong
- Specified by:
writeLong
in interfaceDataOutput
- Specified by:
writeLong
in interfaceRandomAccessInterface
- Throws:
IOException
-
writeFloat
- Specified by:
writeFloat
in interfaceDataOutput
- Specified by:
writeFloat
in interfaceRandomAccessInterface
- Throws:
IOException
-
writeDouble
- Specified by:
writeDouble
in interfaceDataOutput
- Specified by:
writeDouble
in interfaceRandomAccessInterface
- Throws:
IOException
-
writeBytes
- Specified by:
writeBytes
in interfaceDataOutput
- Specified by:
writeBytes
in interfaceRandomAccessInterface
- Throws:
IOException
-
writeChars
- Specified by:
writeChars
in interfaceDataOutput
- Specified by:
writeChars
in interfaceRandomAccessInterface
- Throws:
IOException
-
writeUTF
Write a UTF encoded string I would delegate here. But Java's read/writeUTF combo suck. A signed 2 byte length is not enough. This writes a 4 byte length. The upper byte MUST be zero, if its not, then its not this method and has used an extensible length encoding. This is followed by the bytes of the UTF encoded string, as returned by String.getBytes("UTF-8");- Specified by:
writeUTF
in interfaceDataOutput
- Specified by:
writeUTF
in interfaceRandomAccessInterface
- Throws:
IOException
-