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 public class MMapRandomAccessFile extends RandomAccessFile
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
  • Constructor Details

    • MMapRandomAccessFile

      public MMapRandomAccessFile(String location, String mode) throws IOException
      Deprecated.
      Constructor for in-memory "files"
      Parameters:
      location - used as a name
      mode - the open mode
      Throws:
      IOException - on error
  • Method Details

    • flush

      public void flush()
      Deprecated.
      Description copied from class: RandomAccessFile
      Copy the contents of the buffer to the disk.
      Overrides:
      flush in class RandomAccessFile
    • length

      public long length()
      Deprecated.
      Description copied from class: RandomAccessFile
      Get the length of the file. The data in the buffer (which may not have been written the disk yet) is taken into account.
      Overrides:
      length in class RandomAccessFile
      Returns:
      the length of the file in bytes.
    • seek

      public void seek(long pos)
      Deprecated.
      Description copied from class: RandomAccessFile
      Set the position in the file for the next read or write.
      Overrides:
      seek in class RandomAccessFile
      Parameters:
      pos - the offset (in bytes) from the start of the file.
    • unread

      public void unread()
      Deprecated.
      Description copied from class: RandomAccessFile
      Unread the last byte read. This method should not be used more than once between reading operations, or strange things might happen.
      Overrides:
      unread in class RandomAccessFile
    • read

      public int read()
      Deprecated.
      Description copied from class: RandomAccessFile
      Read a byte of data from the file, blocking until data is available.
      Overrides:
      read in class RandomAccessFile
      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: RandomAccessFile
      Read up to len bytes into an array, at a specified offset. This will block until at least one byte has been read.
      Overrides:
      readBytes in class RandomAccessFile
      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: RandomAccessFile
      Write 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:
      write in interface DataOutput
      Overrides:
      write in class RandomAccessFile
      Parameters:
      b - write this byte
    • writeBytes

      public void writeBytes(byte[] dst, int offset, int length)
      Deprecated.
      Description copied from class: RandomAccessFile
      Write len bytes from an array to the file.
      Overrides:
      writeBytes in class RandomAccessFile
      Parameters:
      dst - the array containing the data.
      offset - the offset in the array to the data.
      length - the length of the data.