|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--inonit.domain.game.card.hearts.ai.Storage
An object which can be used by an AbstractIntelligence
for persistent storage of data.
Storage
extends the operations provided by the
Intelligence.Environment.Storage
interface to provide random access and
methods for reading and writing arbitrary data types.
At any given time, a Storage
has a cursor position. Bytes will be read starting from the cursor position and
written starting at the cursor position. The cursor position can be obtained via the getPosition
method and changed using the moveTo
method.
Method Summary | |
int |
getCapacity()
Returns the number of bytes this Storage can hold. |
int |
getPosition()
Returns the current position of the cursor. |
void |
moveTo(int position)
Causes the cursor to move to the given position. |
byte[] |
read(int length)
Returns a series of bytes starting at the cursor position. |
boolean |
readBoolean()
Reads a boolean starting at the cursor position. |
byte |
readByte()
Reads a byte starting at the cursor position. |
char |
readChar()
Reads a char starting at the cursor position. |
double |
readDouble()
Reads a double starting at the cursor position. |
float |
readFloat()
Reads a float starting at the cursor position. |
int |
readInt()
Reads an int starting at the cursor position. |
long |
readLong()
Reads a long starting at the cursor position. |
short |
readShort()
Reads a short starting at the cursor position. |
java.lang.String |
readString()
Reads a String starting at the cursor position. |
void |
write(byte[] bytes)
Writes a series of bytes to this Storage , starting at the cursor position. |
void |
writeBoolean(boolean b)
Writes the given boolean starting at the cursor position. |
void |
writeByte(byte b)
Writes the given byte starting at the cursor position. |
void |
writeChar(char c)
Writes the given char starting at the cursor position. |
void |
writeDouble(double d)
Writes the given double starting at the cursor position. |
void |
writeFloat(float f)
Writes the given float starting at the cursor position. |
void |
writeInt(int i)
Writes the given int starting at the cursor position. |
void |
writeLong(long l)
Writes the given long starting at the cursor position. |
void |
writeShort(short s)
Writes the given short starting at the cursor position. |
void |
writeString(java.lang.String s)
Writes the given String starting at the cursor position. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public int getCapacity()
Storage
can hold.Storage
, in bytes.public void moveTo(int position)
position
- The index within this Storage
to which the cursor should be moved.public int getPosition()
Storage
.public byte[] read(int length) throws java.io.IOException
length
- The number of bytes to read.length
containing the bytes read.java.io.IOException
- If an input error occurs while reading from this Storage
.public void write(byte[] bytes) throws java.io.IOException
Storage
, starting at the cursor position.bytes
- The bytes to write to this Storage
.java.io.IOException
- If an output error occurs while writing to this Storage
.public byte readByte() throws java.io.IOException
byte
starting at the cursor position.byte
at the cursor position.java.io.IOException
- If an input error occurs while reading from this Storage
.public short readShort() throws java.io.IOException
short
starting at the cursor position.short
at the cursor position.java.io.IOException
- If an input error occurs while reading from this Storage
.public int readInt() throws java.io.IOException
int
starting at the cursor position.int
at the cursor position.java.io.IOException
- If an input error occurs while reading from this Storage
.public long readLong() throws java.io.IOException
long
starting at the cursor position.long
at the cursor position.java.io.IOException
- If an input error occurs while reading from this Storage
.public float readFloat() throws java.io.IOException
float
starting at the cursor position.float
at the cursor position.java.io.IOException
- If an input error occurs while reading from this Storage
.public double readDouble() throws java.io.IOException
double
starting at the cursor position.double
at the cursor position.java.io.IOException
- If an input error occurs while reading from this Storage
.public boolean readBoolean() throws java.io.IOException
boolean
starting at the cursor position.boolean
at the cursor position.java.io.IOException
- If an input error occurs while reading from this Storage
.public char readChar() throws java.io.IOException
char
starting at the cursor position.char
at the cursor position.java.io.IOException
- If an input error occurs while reading from this Storage
.public java.lang.String readString() throws java.io.IOException
String
starting at the cursor position.String
at the cursor position.java.io.IOException
- If an input error occurs while reading from this Storage
.public void writeByte(byte b) throws java.io.IOException
byte
starting at the cursor position.b
- The byte
to writejava.io.IOException
- If an output error occurs while writing to this Storage
.public void writeShort(short s) throws java.io.IOException
short
starting at the cursor position.s
- The short
to writejava.io.IOException
- If an output error occurs while writing to this Storage
.public void writeInt(int i) throws java.io.IOException
int
starting at the cursor position.i
- The int
to writejava.io.IOException
- If an output error occurs while writing to this Storage
.public void writeLong(long l) throws java.io.IOException
long
starting at the cursor position.l
- The long
to writejava.io.IOException
- If an output error occurs while writing to this Storage
.public void writeFloat(float f) throws java.io.IOException
float
starting at the cursor position.f
- The float
to writejava.io.IOException
- If an output error occurs while writing to this Storage
.public void writeDouble(double d) throws java.io.IOException
double
starting at the cursor position.d
- The double
to writejava.io.IOException
- If an output error occurs while writing to this Storage
.public void writeBoolean(boolean b) throws java.io.IOException
boolean
starting at the cursor position.b
- The boolean
to writejava.io.IOException
- If an output error occurs while writing to this Storage
.public void writeChar(char c) throws java.io.IOException
char
starting at the cursor position.c
- The char
to writejava.io.IOException
- If an output error occurs while writing to this Storage
.public void writeString(java.lang.String s) throws java.io.IOException
String
starting at the cursor position.s
- The String
to writejava.io.IOException
- If an output error occurs while writing to this Storage
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |