public class CloseableRandomAccessFile extends FileAccess
Zusätzlich ist die Ein- und Ausgabe gepuffert, wodurch die Performance wesentlich erhöht wird.
Es sollte sichergestellt werden, dass kein anderer Prozess parallel die Datei bearbeitet, sonst entsteht möglicherweise unerwünschtes Verhalten.
_bufferSize, _dataInStream, _dataOutStream, _position, defaultBufferSize| Constructor and Description |
|---|
CloseableRandomAccessFile(java.io.File file) |
CloseableRandomAccessFile(java.io.File file,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
closeFile()
Schließt die Datei auf Betriebssystemebene, aber erlaubt weitere Lese- und Schreibzugriffe.
|
protected java.nio.channels.FileChannel |
getChannel()
Gibt einen gültigen FileChannel zurück, mit dem die Klasse die Datei manipulieren kann.
|
protected java.io.DataInputStream |
getDataInStream()
Gibt einen DataInputStream zum Lesen zurück
|
protected java.io.DataOutputStream |
getDataOutStream()
Gibt einen DataOutputStream zum Schreiben zurück
|
boolean |
isOpen() |
protected void |
openFile() |
flush, flushInStream, flushOutStream, getFilePointer, length, position, position, read, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setLength, size, skip, skipBytes, toString, truncate, write, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTFpublic CloseableRandomAccessFile(java.io.File file)
public CloseableRandomAccessFile(java.io.File file,
int bufferSize)
protected java.io.DataOutputStream getDataOutStream()
throws java.io.IOException
FileAccessgetDataOutStream in class FileAccessjava.io.IOExceptionprotected java.io.DataInputStream getDataInStream()
throws java.io.IOException
FileAccessgetDataInStream in class FileAccessjava.io.IOExceptionprotected final java.nio.channels.FileChannel getChannel()
throws java.io.IOException
FileAccessgetChannel in class FileAccessjava.io.IOExceptionprotected void openFile()
throws java.io.IOException
java.io.IOExceptionpublic boolean isOpen()
isOpen in interface java.nio.channels.ChannelisOpen in class FileAccesspublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface java.nio.channels.Channelclose in class FileAccessjava.io.IOExceptionpublic void closeFile()
throws java.io.IOException
java.io.IOException