|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.farafin.snEADy.inOut.C_RecordFileReader
public class C_RecordFileReader
reads a record file:
file scheme:
for each gameCycle:
what is stored (consumtion)
- Number bytes (2Byte)
- Nnumber of playfield changes (1Byte)
- Playfield changes (3 Byte each)
...
- Player Nr and status changes (1 Byte)
= Player Number (4 bit)
+ speed changed? (1 bit)
+ length changed? (1 bit)
+ Points changed? (1 bit)
+ Status changed? (1 bit)
- playerdata (max 7 Byte)
= new speed (1 Byte) [only if change bit is 1]
+ new Length (2 Byte) [only if change bit is 1]
+ new points (2 Byte) [only if change bit is 1]
+ new Status (1 Byte) [only if change bit is 1]
+ head move direction (1 Byte)
- if player Nr == 15: new Exit Time (8 Byte) + new SDTime (8 Byte) = 17 Byte
Field Summary | |
---|---|
private int |
actPos
Position in the buffer |
private java.io.File |
binFile
Comment for logFile |
private byte[] |
buffer
the buffer of data |
private java.lang.String |
header
Comment for header |
private int |
headerLength
Comment for headerLength |
private int |
startPos
Comment for startPos |
Constructor Summary | |
---|---|
C_RecordFileReader(java.lang.String fileName)
|
|
C_RecordFileReader(java.lang.String root,
java.lang.String fileName)
|
Method Summary | |
---|---|
java.lang.String |
getFileName()
|
boolean |
isFinished()
|
boolean |
isStart()
|
byte[] |
readGameCycle(byte[] buf,
boolean reverse)
gets a game cycle data block |
java.lang.String[] |
readHeader()
reeads the haader of the file |
void |
restart()
next line is set to 0 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.io.File binFile
logFile
private byte[] buffer
private int actPos
private int headerLength
headerLength
private int startPos
startPos
private java.lang.String header
header
Constructor Detail |
---|
public C_RecordFileReader(java.lang.String root, java.lang.String fileName) throws java.io.FileNotFoundException
root
- fileName
-
java.io.FileNotFoundException
public C_RecordFileReader(java.lang.String fileName) throws java.io.FileNotFoundException
fileName
-
java.io.FileNotFoundException
Method Detail |
---|
public java.lang.String[] readHeader()
public byte[] readGameCycle(byte[] buf, boolean reverse)
buf
- The buffer where the data should be stored in. If it is to small, there
will be a new one created and given back.if
- the game should be read reveresed or not
buf
was too small, it will be a new instance returnedpublic boolean isFinished()
public boolean isStart()
public void restart()
public java.lang.String getFileName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |