From 34ffc6b8a4a78ff74f12ebde68a8e87115cbcfd7 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 16 Apr 2015 13:56:01 +0000
Subject: [PATCH] Code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexInputBuffer.java |   58 +++++++++-------------------------------------------------
 1 files changed, 9 insertions(+), 49 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexInputBuffer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexInputBuffer.java
index d03d77c..6f4c564 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexInputBuffer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/IndexInputBuffer.java
@@ -85,8 +85,8 @@
    * @throws IOException
    *           If an IO error occurred when priming the cache.
    */
-  public IndexInputBuffer(IndexManager indexMgr, FileChannel channel,
-      long begin, long end, int bufferID, int cacheSize) throws IOException
+  IndexInputBuffer(IndexManager indexMgr, FileChannel channel, long begin, long end, int bufferID, int cacheSize)
+      throws IOException
   {
     this.indexMgr = indexMgr;
     this.channel = channel;
@@ -130,42 +130,17 @@
    * @throws IOException
    *           If an IO error occurred.
    */
-  public boolean hasMoreData() throws IOException
+  boolean hasMoreData() throws IOException
   {
     boolean hasMore = begin + offset < end;
     return cache.remaining() != 0 || hasMore;
   }
 
-  /**
-   * Returns the length of the next key.
-   *
-   * @return The length of the next key.
-   */
-  public int getKeyLen()
-  {
-    return keyBuffer.length();
-  }
-
-  /**
-   * Fetches the next key into the provided byte string builder.
-   *
-   * @param b
-   *          A builder where to fetch the key
-   */
-  public void fetchKey(ByteStringBuilder b)
-  {
-    b.clear().append(keyBuffer);
-  }
-
-  /**
-   * Returns the index ID of the next record.
-   *
-   * @return The index ID of the next record.
-   */
-  public Integer getIndexID()
+  ImportRecord currentRecord()
   {
     if (record == null)
     {
+      // ensure record fetched
       try
       {
         fetchNextRecord();
@@ -176,7 +151,7 @@
         throw new RuntimeException(ex);
       }
     }
-    return record != null ? record.getIndexID() : null;
+    return record;
   }
 
   /**
@@ -186,7 +161,7 @@
    * @throws IOException
    *           If an IO error occurred.
    */
-  public void fetchNextRecord() throws IOException
+  void fetchNextRecord() throws IOException
   {
     switch (recordState)
     {
@@ -233,15 +208,14 @@
   }
 
   /**
-   * Reads the next ID set from the record and merges it with the provided ID
-   * set.
+   * Reads the next ID set from the record and merges it with the provided ID set.
    *
    * @param idSet
    *          The ID set to be merged.
    * @throws IOException
    *           If an IO error occurred.
    */
-  public void mergeIDSet(ImportIDSet idSet) throws IOException
+  void mergeIDSet(ImportIDSet idSet) throws IOException
   {
     if (recordState == RecordState.START)
     {
@@ -310,18 +284,4 @@
     }
     return cmp;
   }
-
-  ImportRecord currentRecord()
-  {
-    ensureRecordFetched();
-    return record;
-  }
-
-  private void ensureRecordFetched()
-  {
-    if (keyBuffer.length() == 0)
-    {
-      getIndexID();
-    }
-  }
 }

--
Gitblit v1.10.0