public class TAEnabledRandomAccessFile extends Object
getCommittedSize()
Data beyond this range cannot be read and is not available.
|--------|----................---------|------
0 start of committed size
visible data + header size
FileChannel,
RandomAccessFile,
FileLock| Modifier and Type | Field and Description |
|---|---|
static int |
BYTE_BYTES
Groesse eines Bytes
|
static int |
HEADER_LENGTH
Header size.
|
static int |
MAX_BYTE_VALUE
max.
|
| Modifier and Type | Method and Description |
|---|---|
long |
available() |
void |
close()
Schliesst die Datei und den FileChannel
|
void |
commit()
updates the first 4 bytes of the file with the current position of the randomAccessFile
|
void |
forwardWind()
sets the current position to end of the visible data.
|
long |
getCommittedSize()
Gibt die Groesse des Comitteten Bereichs in Byte zurueck.
|
static int |
getHeaderLength()
liefert die Groesse des Headerbereiches
|
boolean |
isClose()
zeigt an, ob die Instanz geschlossen ist
|
byte[] |
read(int length)
reads the next length bytes starting form the current file position.
|
int |
readInt()
reads the next INTEGER starting form the current file position.
|
long |
readLong()
reads the next LONG starting form the current file position.
|
short |
readShort()
reads the next SHORT starting form the current file position.
|
void |
reset()
updates the committed size with 0.
|
void |
rewind()
sets the current position to the start of the data.
|
void |
write(byte[] buffer)
appends a byte[] to the file, but doesn't commit.
|
void |
writeInt(int value)
appends an INT to the file, but doesn't commit
|
void |
writeLong(long value)
appends a LONG to the file, but doesn't commit
|
void |
writeShort(short value)
appends a SHORT to the file, but doesn't commit
|
public static final int HEADER_LENGTH
public static final int BYTE_BYTES
public static final int MAX_BYTE_VALUE
public static int getHeaderLength()
public long available()
throws IOException
IOExceptionpublic void close()
throws IOException
IOException - , wenn das Schliessen schief geht.public boolean isClose()
public long getCommittedSize()
throws IOException
IOException - IO-Errorpublic int readInt()
throws IOException
IOException - IO Errorpublic short readShort()
throws IOException
IOException - IO Errorpublic long readLong()
throws IOException
IOException - IO Errorpublic byte[] read(int length)
throws IOException
length - umber of bytes to be readIOException - IO Errorpublic void write(byte[] buffer)
throws IOException
buffer - value to be appendedIOException - IO Errorread(int)public void writeShort(short value)
throws IOException
value - value to be appendedIOException - IO Errorpublic void writeInt(int value)
throws IOException
value - value to be appendedIOException - IO Errorpublic void writeLong(long value)
throws IOException
value - value to be appendedIOException - IO Errorpublic void rewind()
throws IOException
IOExceptionpublic void forwardWind()
throws IOException
IOExceptionpublic void reset()
throws IOException
IOExceptionpublic void commit()
throws IOException
IOException - Error updating the fileCopyright © 2017. All rights reserved.