net.dontdrinkandroot.cache.impl.disk.indexed.storage

## Class IndexFile

- java.lang.Object
- - net.dontdrinkandroot.cache.impl.disk.indexed.storage.IndexFile

    public class IndexFile
    extends Object

Author:
  Philip W. Sorst <philip@sorst.net>

### Field Summary

Fields
`static float` `GOLDEN_RATIO`

### Constructor Summary

Constructors
Constructor and Description
`IndexFile(File file)`

### Method Summary

Methods
`void` `close()` Closes the underlying random access file.
`void` `delete(IndexData indexData)` Deletes the block of the given metaData.
`void` `delete(int blockNum)` Deletes the given block.
`int` `getNumAllocated()` Gets the number of allocated blocks.
`Collection<IndexData>` `initialize()`
`long` `length()` Returns the length of the underlying random access file.
`IndexData` `write(IndexData indexData)`

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

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

### Field Detail

#### GOLDEN_RATIO

    public static float GOLDEN_RATIO

### Constructor Detail

#### IndexFile

    public IndexFile(File file)
              throws FileNotFoundException

Throws:
  `FileNotFoundException`

### Method Detail

#### close

    public void close()
               throws IOException

Closes the underlying random access file.

Throws:
  `IOException`

#### delete

    public void delete(IndexData indexData)
                throws IOException

Deletes the block of the given metaData.

Throws:
  `IOException`

#### delete

    public void delete(int blockNum)
                throws IOException

Deletes the given block.

Throws:
  `IOException`

#### getNumAllocated

    public int getNumAllocated()

Gets the number of allocated blocks.

#### initialize

    public Collection<IndexData> initialize()
                                     throws IOException

Throws:
  `IOException`

#### length

    public long length()
                throws IOException

Returns the length of the underlying random access file.

Throws:
  `IOException`

#### write

    public IndexData write(IndexData indexData)
                    throws IOException

Throws:
  `IOException`