Class BufferedRandomAccessFile

  • All Implemented Interfaces:
    java.io.Closeable, java.io.DataInput, java.io.DataOutput, java.lang.AutoCloseable

    public class BufferedRandomAccessFile
    extends java.io.RandomAccessFile
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.Long,​byte[]> buffer  
      private int bufferSize  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int read()  
      int read​(byte[] b)  
      int read​(long seek, byte[] b)  
      void seek​(long pos)  
      void write​(long seek, byte[] array)  
      void writeByte​(long seek, byte value)  
      void writeChar​(long seek, char value)  
      void writeDouble​(long seek, double value)  
      void writeFloat​(long seek, float value)  
      void writeInt​(long seek, int value)  
      void writeLong​(long seek, long value)  
      void writeShort​(long seek, short value)  
      • Methods inherited from class java.io.RandomAccessFile

        close, getChannel, getFD, getFilePointer, length, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, setLength, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • bufferSize

        private int bufferSize
      • buffer

        private final java.util.Map<java.lang.Long,​byte[]> buffer
    • Constructor Detail

      • BufferedRandomAccessFile

        public BufferedRandomAccessFile​(java.io.File file,
                                        java.lang.String mode)
                                 throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
      • BufferedRandomAccessFile

        public BufferedRandomAccessFile​(java.io.File file,
                                        java.lang.String mode,
                                        int bufferSize)
                                 throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Overrides:
        read in class java.io.RandomAccessFile
        Throws:
        java.io.IOException
      • seek

        public void seek​(long pos)
                  throws java.io.IOException
        Overrides:
        seek in class java.io.RandomAccessFile
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b)
                 throws java.io.IOException
        Overrides:
        read in class java.io.RandomAccessFile
        Throws:
        java.io.IOException
      • read

        public int read​(long seek,
                        byte[] b)
                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeByte

        public void writeByte​(long seek,
                              byte value)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • writeChar

        public void writeChar​(long seek,
                              char value)
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • writeDouble

        public void writeDouble​(long seek,
                                double value)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • writeFloat

        public void writeFloat​(long seek,
                               float value)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeShort

        public void writeShort​(long seek,
                               short value)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        public void write​(long seek,
                          byte[] array)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeInt

        public void writeInt​(long seek,
                             int value)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLong

        public void writeLong​(long seek,
                              long value)
                       throws java.io.IOException
        Throws:
        java.io.IOException