|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindprod.ledatastream.LERandomAccessFile
public final class LERandomAccessFile
Little-endian version of RandomAccessFile.
Field Summary | |
---|---|
protected java.io.RandomAccessFile |
raf
to get at the big-endian methods of RandomAccessFile . |
protected byte[] |
work
work array for buffering input/output. |
Constructor Summary | |
---|---|
LERandomAccessFile(java.io.File file,
java.lang.String rw)
constructor. |
|
LERandomAccessFile(java.lang.String file,
java.lang.String rw)
constructors. |
Method Summary | |
---|---|
void |
close()
close the file. |
java.io.FileDescriptor |
getFD()
Get file descriptor. |
long |
getFilePointer()
get position of marker in the file. |
long |
length()
get length of the file. |
int |
read()
ready one unsigned byte. |
int |
read(byte[] ba)
read an array of bytes. |
int |
read(byte[] ba,
int off,
int len)
Read a byte array. |
boolean |
readBoolean()
OK, reads only only 1 byte boolean. |
byte |
readByte()
read byte. |
char |
readChar()
Read a char. |
double |
readDouble()
read a double. |
float |
readFloat()
read a float. |
void |
readFully(byte[] ba)
Read a full array. |
void |
readFully(byte[] ba,
int off,
int len)
read an array of bytes until the count is satisfied. |
int |
readInt()
read signed little endian 32-bit int. |
java.lang.String |
readLine()
Read a line. |
long |
readLong()
Read a long, 64 bits. |
short |
readShort()
Read a short, 16 bits. |
int |
readUnsignedByte()
return an unsigned byte. |
int |
readUnsignedShort()
Read an unsigned short, 16 bits. |
java.lang.String |
readUTF()
Read a counted UTF-8 string. |
void |
seek(long pos)
seek to a place in the file |
int |
skipBytes(int n)
Skip over bytes. |
void |
write(byte[] ba)
Write an array of bytes. |
void |
write(byte[] ba,
int off,
int len)
Write part of an array of bytes. |
void |
write(int ib)
Write a byte. |
void |
writeBoolean(boolean v)
write a boolean as one byte. |
void |
writeByte(int v)
Write a byte. |
void |
writeBytes(java.lang.String s)
Write bytes from a String. |
void |
writeChar(int v)
Write a char. |
void |
writeChars(java.lang.String s)
Write a string, even though method called writeChars. |
void |
writeDouble(double v)
Write a double. |
void |
writeFloat(float v)
Write a float. |
void |
writeInt(int v)
write an int, 32-bits. |
void |
writeLong(long v)
Write i long, 64 bits. |
void |
writeShort(int v)
Write an signed short even though parameter is an int. |
void |
writeUTF(java.lang.String s)
Write a counted UTF string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.io.RandomAccessFile raf
protected byte[] work
Constructor Detail |
---|
public LERandomAccessFile(java.io.File file, java.lang.String rw) throws java.io.FileNotFoundException
file
- file to read/write.rw
- like RandomAccessFile
where "r" for read "rw" for read and write, "rws" for
read-write sync, and "rwd" for read-write dsync. Sync ensures the physical I/O has completed befor
the method returns.
java.io.FileNotFoundException
- if open fails.public LERandomAccessFile(java.lang.String file, java.lang.String rw) throws java.io.FileNotFoundException
file
- name of file.rw
- string "r" or "rw" depending on read or read/write.
java.io.FileNotFoundException
- if open fails.Method Detail |
---|
public final void close() throws java.io.IOException
java.io.IOException
- if close fails.public final java.io.FileDescriptor getFD() throws java.io.IOException
java.io.IOException
- if get fails.public final long getFilePointer() throws java.io.IOException
java.io.IOException
- if get fails.public final long length() throws java.io.IOException
java.io.IOException
- if get fails.public final int read() throws java.io.IOException
java.io.IOException
- if read fails.public final int read(byte[] ba) throws java.io.IOException
ba
- byte array to accept the bytes.
java.io.IOException
- if read fails.public final int read(byte[] ba, int off, int len) throws java.io.IOException
ba
- byte array to accept teh bytes.off
- offset into the array to place the bytes, not offset in file.len
- how many bytes to read.
java.io.IOException
- if read fails.public final boolean readBoolean() throws java.io.IOException
readBoolean
in interface java.io.DataInput
java.io.IOException
- if read fails.public final byte readByte() throws java.io.IOException
readByte
in interface java.io.DataInput
java.io.IOException
- if read fails.public final char readChar() throws java.io.IOException
readChar
in interface java.io.DataInput
java.io.IOException
- if read fails.public final double readDouble() throws java.io.IOException
readDouble
in interface java.io.DataInput
java.io.IOException
- if read fails.public final float readFloat() throws java.io.IOException
readFloat
in interface java.io.DataInput
java.io.IOException
- if read fails.public final void readFully(byte[] ba) throws java.io.IOException
readFully
in interface java.io.DataInput
ba
- the array to hold the results.
java.io.IOException
- if read fails.public final void readFully(byte[] ba, int off, int len) throws java.io.IOException
readFully
in interface java.io.DataInput
ba
- the array to hold the results.off
- offset.len
- count of bytes to read.
java.io.IOException
- if read fails.public final int readInt() throws java.io.IOException
readInt
in interface java.io.DataInput
java.io.IOException
- if read fails.except little endian.
public final java.lang.String readLine() throws java.io.IOException
readLine
in interface java.io.DataInput
java.io.IOException
- if read fails.public final long readLong() throws java.io.IOException
readLong
in interface java.io.DataInput
java.io.IOException
- if read fails.public final short readShort() throws java.io.IOException
readShort
in interface java.io.DataInput
java.io.IOException
- if read fails.public final java.lang.String readUTF() throws java.io.IOException
readUTF
in interface java.io.DataInput
java.io.IOException
- if read fails.public final int readUnsignedByte() throws java.io.IOException
readUnsignedByte
in interface java.io.DataInput
java.io.IOException
- if read fails.public final int readUnsignedShort() throws java.io.IOException
readUnsignedShort
in interface java.io.DataInput
java.io.IOException
- if read fails.public final void seek(long pos) throws java.io.IOException
pos
- 0-based offset to seek to.
java.io.IOException
- if read fails.public final int skipBytes(int n) throws java.io.IOException
skipBytes
in interface java.io.DataInput
n
- number of bytes to skip over.
java.io.IOException
- if read fails.public final void write(int ib) throws java.io.IOException
write
in interface java.io.DataOutput
ib
- byte to write.
java.io.IOException
- if read fails.public final void write(byte[] ba) throws java.io.IOException
write
in interface java.io.DataOutput
ba
- array to write.
java.io.IOException
- if read fails.DataOutput.write(byte[])
public final void write(byte[] ba, int off, int len) throws java.io.IOException
write
in interface java.io.DataOutput
ba
- array to write.off
- offsetlen
- count of bytes to write.
java.io.IOException
- if read fails.DataOutput.write(byte[],int,int)
public final void writeBoolean(boolean v) throws java.io.IOException
writeBoolean
in interface java.io.DataOutput
v
- boolean to write.
java.io.IOException
- if read fails.DataOutput.writeBoolean(boolean)
public final void writeByte(int v) throws java.io.IOException
writeByte
in interface java.io.DataOutput
v
- byte to write.
java.io.IOException
- if read fails.DataOutput.writeByte(int)
public final void writeBytes(java.lang.String s) throws java.io.IOException
writeBytes
in interface java.io.DataOutput
s
- string source of the bytes.
java.io.IOException
- if read fails.DataOutput.writeBytes(java.lang.String)
public final void writeChar(int v) throws java.io.IOException
writeChar
in interface java.io.DataOutput
v
- char to write. like RandomAcessFile.writeChar. Note the parm is an int even though this as a writeChar
java.io.IOException
- if read fails.public final void writeChars(java.lang.String s) throws java.io.IOException
writeChars
in interface java.io.DataOutput
s
- Strinhg to write.
java.io.IOException
- if read fails.public final void writeDouble(double v) throws java.io.IOException
writeDouble
in interface java.io.DataOutput
v
- double to write.
java.io.IOException
- if read fails.public final void writeFloat(float v) throws java.io.IOException
writeFloat
in interface java.io.DataOutput
v
- float to write.
java.io.IOException
- if read fails.public final void writeInt(int v) throws java.io.IOException
writeInt
in interface java.io.DataOutput
v
- int to write.
java.io.IOException
- if read fails.public final void writeLong(long v) throws java.io.IOException
writeLong
in interface java.io.DataOutput
v
- long write.
java.io.IOException
- if read fails.RandomAccessFile.writeLong(long)
public final void writeShort(int v) throws java.io.IOException
writeShort
in interface java.io.DataOutput
v
- signed number to write
java.io.IOException
- if read fails.public final void writeUTF(java.lang.String s) throws java.io.IOException
writeUTF
in interface java.io.DataOutput
s
- String to write.
java.io.IOException
- if read fails.DataOutput.writeUTF(java.lang.String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |