org.apache.lucene.store

## Class RAMFile

- java.lang.Object
- - org.apache.lucene.store.RAMFile

- All Implemented Interfaces:
    Accountable

      public class RAMFile
      extends Object
      implements Accountable

  Represents a file in RAM as a list of byte[] buffers.
  NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ArrayList<byte[]>` | `buffers`
    `protected long` | `sizeInBytes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RAMFile()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected byte[]` | `addBuffer(int size)`
    `boolean` | `equals(Object obj)`
    `protected byte[]` | `getBuffer(int index)`
    `Collection<Accountable>` | `getChildResources()` Returns nested resources of this class.
    `long` | `getLength()`
    `int` | `hashCode()`
    `protected byte[]` | `newBuffer(int size)` Expert: allocate a new buffer.
    `protected int` | `numBuffers()`
    `long` | `ramBytesUsed()` Return the memory usage of this object in bytes.
    `protected void` | `setLength(long length)`
    `String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### buffers

          protected final ArrayList<byte[]> buffers

    - #### sizeInBytes

          protected long sizeInBytes

  - ### Constructor Detail

    - #### RAMFile

          public RAMFile()

  - ### Method Detail

    - #### getLength

          public long getLength()

    - #### setLength

          protected void setLength(long length)

    - #### addBuffer

          protected final byte[] addBuffer(int size)

    - #### getBuffer

          protected final byte[] getBuffer(int index)

    - #### numBuffers

          protected final int numBuffers()

    - #### newBuffer

          protected byte[] newBuffer(int size)

      Expert: allocate a new buffer. Subclasses can allocate differently.
      Parameters:
        `size` - size of allocated buffer.
      Returns:
        allocated buffer.

    - #### ramBytesUsed

          public long ramBytesUsed()

      Description copied from interface: `Accountable`
      Return the memory usage of this object in bytes. Negative values are illegal.
      Specified by:
        `ramBytesUsed` in interface `Accountable`

    - #### getChildResources

          public Collection<Accountable> getChildResources()

      Description copied from interface: `Accountable`
      Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions).
      Specified by:
        `getChildResources` in interface `Accountable`
      See Also:
        `Accountables`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.