Package org.eclipse.mat.parser.index

# Class IndexReader.IntIndexReader

java.lang.Object
org.eclipse.mat.parser.index.IndexReader.IntIndexReader

All Implemented Interfaces:
  `IIndexReader`, `IIndexReader.IOne2OneIndex`

Enclosing class:
  `IndexReader`

public static class IndexReader.IntIndexReader extends Object implements IIndexReader.IOne2OneIndex
An int to int index reader. Disk file structure:

     Page 0: ArrayIntCompressed
     Page 1: ArrayIntCompressed
     ...
     Page n: ArrayIntCompressed
     page 0 start in file (8)
     page 1 start in file (8)
     ...
     page n start in file (8)
     page n+1 start in file (8) (i.e. location of 'page 0 start in file' field)
     page size (4)
     total size (4)

Experimental for version 1.2: The disk format has been enhanced to allow more than 2^31 entries by using the page n+1 start pointer to find the start of the page offsets, and so the number of pages, and the size field is then negative and used to measure the number of entries on the last page (from 1 to page size). This is experimental and index files with 2^31 entries or more are not compatible with 1.1 or earlier and might not be compatible with 1.3 or later.

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.eclipse.mat.parser.index.IIndexReader

`IIndexReader.IOne2LongIndex, IIndexReader.IOne2ManyIndex, IIndexReader.IOne2ManyObjectsIndex, IIndexReader.IOne2OneIndex, IIndexReader.IOne2SizeIndex`

## Field Summary

Fields
Modifier and Type
Field
Description
`SimpleBufferedRandomAccessInputStream`
`in`
For use reading the actual index file
`Object`
`LOCK`
The lock to protect the read from concurrent access

## Constructor Summary

Constructors
Constructor
Description
`IntIndexReader(File indexFile)`
`IntIndexReader(File indexFile, org.eclipse.mat.parser.index.IndexWriter.Pages<SoftReference<ArrayIntCompressed>> pages, int size, int pageSize, long[] pageStart)`
`IntIndexReader(SimpleBufferedRandomAccessInputStream in, long start, long length)`

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Close the backing file.
`void`
`delete()`
Delete the backing file.
`int`
`get(int index)`
`int[]`
`getAll(int[] index)`
`int[]`
`getNext(int index, int length)`
`IteratorInt`
`iterator()`
`void`
`set(int index, int value)`
`int`
`size()`
`void`
`unload()`
Clear the caches.

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

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

### Methods inherited from interface org.eclipse.mat.parser.index.IIndexReader

`size`

### Methods inherited from interface org.eclipse.mat.parser.index.IIndexReader.IOne2OneIndex

`get, getAll, getNext`

## Field Details

### LOCK

public Object LOCK
The lock to protect the read from concurrent access

### in

public SimpleBufferedRandomAccessInputStream in
For use reading the actual index file

## Constructor Details

### IntIndexReader

public IntIndexReader(File indexFile, org.eclipse.mat.parser.index.IndexWriter.Pages<SoftReference<ArrayIntCompressed>> pages, int size, int pageSize, long[] pageStart)

### IntIndexReader

public IntIndexReader(File indexFile) throws IOException

Throws:
  `IOException`

### IntIndexReader

public IntIndexReader(SimpleBufferedRandomAccessInputStream in, long start, long length) throws IOException

Throws:
  `IOException`

## Method Details

### unload

public void unload()
Description copied from interface: `IIndexReader`
Clear the caches. Used when the indexes are not current in use and the memory needs to be reclaimed such as when building the dominator tree.

Specified by:
  `unload` in interface `IIndexReader`

### close

public void close()
Description copied from interface: `IIndexReader`
Close the backing file.

Specified by:
  `close` in interface `IIndexReader`

### delete

public void delete()
Description copied from interface: `IIndexReader`
Delete the backing file.

Specified by:
  `delete` in interface `IIndexReader`

### get

public int get(int index)

### getNext

public int[] getNext(int index, int length)

### getAll

public int[] getAll(int[] index)

### set

public void set(int index, int value)

### size

public int size()

### iterator

public IteratorInt iterator()