Package ucar.unidata.io
Class MMapRandomAccessFile
java.lang.Object
ucar.unidata.io.RandomAccessFile
ucar.unidata.io.MMapRandomAccessFile
- All Implemented Interfaces:
Closeable,DataInput,DataOutput,AutoCloseable,ucar.nc2.util.cache.FileCacheable
Deprecated.
not part of public API.
Use NIO MappedByteBuffer to implement a RandomAccessFile.
Limited to 2G size. Not currently used - NOT UP TO DATE DO NOT USE
-
Field Summary
Fields inherited from class ucar.unidata.io.RandomAccessFile
BIG_ENDIAN, LITTLE_ENDIAN -
Constructor Summary
ConstructorsConstructorDescriptionMMapRandomAccessFile(String location, String mode) Deprecated.Constructor for in-memory "files" -
Method Summary
Modifier and TypeMethodDescriptionvoidflush()Deprecated.Copy the contents of the buffer to the disk.longlength()Deprecated.Get the length of the file.intread()Deprecated.Read a byte of data from the file, blocking until data is available.intreadBytes(byte[] dst, int offset, int length) Deprecated.Read up tolenbytes into an array, at a specified offset.voidseek(long pos) Deprecated.Set the position in the file for the next read or write.voidunread()Deprecated.Unread the last byte read.voidwrite(int b) Deprecated.Write a byte to the file.voidwriteBytes(byte[] dst, int offset, int length) Deprecated.Writelenbytes from an array to the file.Methods inherited from class ucar.unidata.io.RandomAccessFile
acquire, acquire, close, eject, enableDefaultGlobalFileCache, getAllFiles, getBufferSize, getDebugLeaks, getDebugNbytes, getDebugNseeks, getFilePointer, getGlobalFileCache, getLastModified, getLocation, getMaxOpenFileCount, getOpenFileCount, getOpenFiles, getRandomAccessFile, isAtEndOfFile, isDirectory, order, order, reacquire, read, read, readBoolean, readByte, readBytes, readChar, readDouble, readDouble, readFloat, readFloat, readFully, readFully, readInt, readInt, readIntUnbuffered, readLine, readLine, readLong, readLong, readShort, readShort, readString, readString, readStringMax, readStringMax, readToByteChannel, readUnsignedByte, readUnsignedShort, readUTF, release, searchForward, setBufferSize, setDebugAccess, setDebugLeaks, setExtendMode, setFileCache, setGlobalFileCache, setMinLength, shutdown, skipBytes, skipBytes, toString, write, write, writeBoolean, writeBoolean, writeByte, writeBytes, writeBytes, writeChar, writeChar, writeChar, writeChar, writeChar, writeChar, writeChars, writeChars, writeChars, writeDouble, writeDouble, writeDouble, writeDouble, writeDouble, writeDouble, writeFloat, writeFloat, writeFloat, writeFloat, writeFloat, writeFloat, writeInt, writeInt, writeInt, writeInt, writeInt, writeInt, writeLong, writeLong, writeLong, writeLong, writeLong, writeLong, writeShort, writeShort, writeShort, writeShort, writeShort, writeShort, writeUTF
-
Constructor Details
-
MMapRandomAccessFile
Deprecated.Constructor for in-memory "files"- Parameters:
location- used as a namemode- the open mode- Throws:
IOException- on error
-
-
Method Details
-
flush
public void flush()Deprecated.Description copied from class:RandomAccessFileCopy the contents of the buffer to the disk.- Overrides:
flushin classRandomAccessFile
-
length
public long length()Deprecated.Description copied from class:RandomAccessFileGet the length of the file. The data in the buffer (which may not have been written the disk yet) is taken into account.- Overrides:
lengthin classRandomAccessFile- Returns:
- the length of the file in bytes.
-
seek
public void seek(long pos) Deprecated.Description copied from class:RandomAccessFileSet the position in the file for the next read or write.- Overrides:
seekin classRandomAccessFile- Parameters:
pos- the offset (in bytes) from the start of the file.
-
unread
public void unread()Deprecated.Description copied from class:RandomAccessFileUnread the last byte read. This method should not be used more than once between reading operations, or strange things might happen.- Overrides:
unreadin classRandomAccessFile
-
read
public int read()Deprecated.Description copied from class:RandomAccessFileRead a byte of data from the file, blocking until data is available.- Overrides:
readin classRandomAccessFile- Returns:
- the next byte of data, or -1 if the end of the file is reached.
-
readBytes
public int readBytes(byte[] dst, int offset, int length) Deprecated.Description copied from class:RandomAccessFileRead up tolenbytes into an array, at a specified offset. This will block until at least one byte has been read.- Overrides:
readBytesin classRandomAccessFile- Parameters:
dst- the byte array to receive the bytes.offset- the offset in the array where copying will start.length- the number of bytes to copy.- Returns:
- the actual number of bytes read, or -1 if there is not more data due to the end of the file being reached.
-
write
public void write(int b) Deprecated.Description copied from class:RandomAccessFileWrite a byte to the file. If the file has not been opened for writing, an IOException will be raised only when an attempt is made to write the buffer to the file. Caveat: the effects of seek( )ing beyond the end of the file are undefined.- Specified by:
writein interfaceDataOutput- Overrides:
writein classRandomAccessFile- Parameters:
b- write this byte
-
writeBytes
public void writeBytes(byte[] dst, int offset, int length) Deprecated.Description copied from class:RandomAccessFileWritelenbytes from an array to the file.- Overrides:
writeBytesin classRandomAccessFile- Parameters:
dst- the array containing the data.offset- the offset in the array to the data.length- the length of the data.
-