> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Class: BufferedRandomAccessFile

**Package:** `com.phoenix_int.util`

**Class Hierarchy**

```java theme={null}
↳ java.lang.Object
  ↳ com.phoenix_int.util.BufferedRandomAccessFile
```

***

**Declaration**

```java theme={null}
public class BufferedRandomAccessFile
extends java.lang.Object
```

Replacement for RandomAccessFile to use buffered I/O as much as possible. Mostly identical to `java.io.RandomAccessFile` API, or at least as close enough for what I needed.

**Note:** This class is not threadsafe.

## Field Summary

| Modifier and Type | Field and Description |
| - | - |
| `protected long` | `_actualPos` |
| `protected byte[]` | `_buffer` |
| `protected long` | `_bufStart` |
| `protected long` | `_fileLen` |
| `protected long` | `_filePos` |
| `protected int` | `_readOffset` |
| `protected java.io.RandomAccessFile` | `_wrapped` |
| `protected int` | `_writeOffset` |

## Constructor Summary

| Constructor and Description |
| - |
| `BufferedRandomAccessFile(java.io.File file, java.lang.String mode, int bufSize)` Constructs a BufferedRandomAccessFile |

## Method Summary

| Modifier and Type | Method and Description |
| - | - |
| `boolean` | `_readBuf()` |
| `void` | `close()` |
| `void` | `flush()` |
| `long` | `length()` |
| `int` | `read()` |
| `int` | `read(byte[] buf)` |
| `int` | `read(byte[] buf, int offset, int len)` |
| `void` | `seek(long position)` |
| `void` | `write(byte[] buf)` |
| `void` | `write(byte[] buf, int offset, int len)` |

### Methods inherited from class java.lang.Object

`clone`, `equals`, `finalize`, `getClass`, `hashCode`, `notify`, `notifyAll`, `toString`, `wait`, `wait`, `wait`

## Field Detail

### \_wrapped

```java theme={null}
protected java.io.RandomAccessFile _wrapped
```

### \_filePos

```java theme={null}
protected long _filePos
```

### \_fileLen

```java theme={null}
protected long _fileLen
```

### \_actualPos

```java theme={null}
protected long _actualPos
```

### \_bufStart

```java theme={null}
protected long _bufStart
```

### \_buffer

```java theme={null}
protected byte[] _buffer
```

### \_writeOffset

```java theme={null}
protected int _writeOffset
```

### \_readOffset

```java theme={null}
protected int _readOffset
```

## Constructor Detail

### BufferedRandomAccessFile

```java theme={null}
public BufferedRandomAccessFile(java.io.File file,
                                java.lang.String mode,
                                int bufSize)
                         throws java.io.IOException
```

**Parameters:**

* `file` - The file to open
* `mode` - Same as for RandomAccessFile's constructor
* `bufSize` - How big to make the in-memory cache.

**Throws:**

* `java.io.IOException`

## Method Detail

### length

```java theme={null}
public long length()
            throws java.io.IOException
```

**Throws:**

* `java.io.IOException`

### seek

```java theme={null}
public void seek(long position)
```

### close

```java theme={null}
public void close()
           throws java.io.IOException
```

**Throws:**

* `java.io.IOException`

### write

```java theme={null}
public void write(byte[] buf)
           throws java.io.IOException
```

**Throws:**

* `java.io.IOException`

### write

```java theme={null}
public void write(byte[] buf,
                  int offset,
                  int len)
           throws java.io.IOException
```

**Throws:**

* `java.io.IOException`

### flush

```java theme={null}
public void flush()
           throws java.io.IOException
```

**Throws:**

* `java.io.IOException`

### read

```java theme={null}
public int read()
         throws java.io.IOException
```

**Throws:**

* `java.io.IOException`

### read

```java theme={null}
public int read(byte[] buf)
         throws java.io.IOException
```

**Throws:**

* `java.io.IOException`

### read

```java theme={null}
public int read(byte[] buf,
                int offset,
                int len)
         throws java.io.IOException
```

**Throws:**

* `java.io.IOException`

### \_readBuf

```java theme={null}
public boolean _readBuf()
                 throws java.io.IOException
```

**Throws:**

* `java.io.IOException`
