org.eclipse.net4j.util.io

## Class SortedFileMap<K extends Comparable<K>,V>

- java.lang.Object
- - org.eclipse.net4j.util.io.SortedFileMap<K,V>

- All Implemented Interfaces:
    Closeable, AutoCloseable
  Direct Known Subclasses:
    CachedFileMap

      public abstract class SortedFileMap<K extends Comparable<K>,V>
      extends Object
      implements Closeable

  Author:
    Eike Stepper

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SortedFileMap(File file, String mode)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `V` | `get(K key)`
    `long` | `getEntryCount()`
    `int` | `getEntrySize()`
    `File` | `getFile()`
    `K` | `getKey(long index)`
    `abstract int` | `getKeySize()`
    `K` | `getMaxKey()`
    `long` | `getPosition(long index)`
    `RandomAccessFile` | `getRandomAccessFile()`
    `V` | `getValue(long index)`
    `long` | `getValuePosition(long index)`
    `abstract int` | `getValueSize()`
    `V` | `put(K key, V value)`
    `protected abstract K` | `readKey(ExtendedDataInput in)`
    `protected abstract V` | `readValue(ExtendedDataInput in)`
    `protected long` | `search(K key)`
    `protected abstract void` | `writeKey(ExtendedDataOutput out, K key)`
    `protected abstract void` | `writeValue(ExtendedDataOutput out, V value)`

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

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

- - ### Constructor Detail

    - #### SortedFileMap

          public SortedFileMap(File file,
                               String mode)

      See Also:
        `RandomAccessFile.RandomAccessFile(File, String)`

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

    - #### getFile

          public File getFile()

    - #### getRandomAccessFile

          public RandomAccessFile getRandomAccessFile()

    - #### getEntryCount

          public long getEntryCount()

    - #### getEntrySize

          public int getEntrySize()

    - #### getPosition

          public long getPosition(long index)

    - #### getValuePosition

          public long getValuePosition(long index)

    - #### getMaxKey

          public K getMaxKey()

    - #### getKey

          public K getKey(long index)

    - #### getValue

          public V getValue(long index)

    - #### get

          public V get(K key)

    - #### put

          public V put(K key,
                       V value)

    - #### search

          protected long search(K key)
                         throws IOException

      Returns:
        The index of the entry with the given key if the key exists, `-(insertionIndex + 1)` otherwise.
      Throws:
        `IOException`

    - #### getKeySize

          public abstract int getKeySize()

    - #### readKey

          protected abstract K readKey(ExtendedDataInput in)
                                throws IOException

      Throws:
        `IOException`

    - #### writeKey

          protected abstract void writeKey(ExtendedDataOutput out,
                                           K key)
                                    throws IOException

      Throws:
        `IOException`

    - #### getValueSize

          public abstract int getValueSize()

    - #### readValue

          protected abstract V readValue(ExtendedDataInput in)
                                  throws IOException

      Throws:
        `IOException`

    - #### writeValue

          protected abstract void writeValue(ExtendedDataOutput out,
                                             V value)
                                      throws IOException

      Throws:
        `IOException`

Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html