org.apache.fontbox.ttf

## Class BufferedRandomAccessFile

- java.lang.Object
- - java.io.RandomAccessFile
  - - org.apache.fontbox.ttf.BufferedRandomAccessFile

All Implemented Interfaces:
  Closeable, DataInput, DataOutput, AutoCloseable

    public class BufferedRandomAccessFile
    extends RandomAccessFile

This class is a version of the one published at https://code.google.com/p/jmzreader/wiki/BufferedRandomAccessFile augmented to handle unsigned bytes. The original class is published under Apache 2.0 license. Fix is marked below This is an optimized version of the RandomAccessFile class as described by Nick Zhang on JavaWorld.com. The article can be found at http://www.javaworld.com/javaworld/javatips/jw-javatip26.html

Author:
  jg

### Constructor Summary

Constructors
Constructor and Description
`BufferedRandomAccessFile(File file, String mode, int bufsize)` Creates a new instance of the BufferedRandomAccessFile.
`BufferedRandomAccessFile(String filename, String mode, int bufsize)` Creates a new instance of the BufferedRandomAccessFile.

### Method Summary

All Methods Instance Methods Concrete Methods
`long` `getFilePointer()`
`int` `read()`
`int` `read(byte[] b, int off, int len)`
`void` `seek(long pos)`

### Methods inherited from class java.io.RandomAccessFile

`close, getChannel, getFD, 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`

### Constructor Detail

#### BufferedRandomAccessFile

    public BufferedRandomAccessFile(String filename,
                                    String mode,
                                    int bufsize)
                             throws FileNotFoundException

Creates a new instance of the BufferedRandomAccessFile.

Parameters:
  `filename` - The path of the file to open.
  `mode` - Specifies the mode to use ("r", "rw", etc.) See the BufferedLineReader documentation for more information.
  `bufsize` - The buffer size (in bytes) to use.
Throws:
  `FileNotFoundException` - If the mode is "r" but the given string does not denote an existing regular file, or if the mode begins with "rw" but the given string does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file.

#### BufferedRandomAccessFile

    public BufferedRandomAccessFile(File file,
                                    String mode,
                                    int bufsize)
                             throws FileNotFoundException

Creates a new instance of the BufferedRandomAccessFile.

Parameters:
  `file` - The file to open.
  `mode` - Specifies the mode to use ("r", "rw", etc.) See the BufferedLineReader documentation for more information.
  `bufsize` - The buffer size (in bytes) to use.
Throws:
  `FileNotFoundException` - If the mode is "r" but the given file path does not denote an existing regular file, or if the mode begins with "rw" but the given file path does not denote an existing, writable regular file and a new regular file of that name cannot be created, or if some other error occurs while opening or creating the file.

### Method Detail

#### read

    public final int read()
                   throws IOException

Overrides:
  `read` in class `RandomAccessFile`
Throws:
  `IOException`

#### read

    public int read(byte[] b,
                    int off,
                    int len)
             throws IOException

Overrides:
  `read` in class `RandomAccessFile`
Throws:
  `IOException`

#### getFilePointer

    public long getFilePointer()
                        throws IOException

Overrides:
  `getFilePointer` in class `RandomAccessFile`
Throws:
  `IOException`

#### seek

    public void seek(long pos)
              throws IOException

Overrides:
  `seek` in class `RandomAccessFile`
Throws:
  `IOException`