From 183e31c0e78920b50a704780c022291a6139c032 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 21 Mar 2014 15:16:28 +0000
Subject: [PATCH] OPENDJ-1368 (CR-3232) Remove AttributeValue
---
opendj3-server-dev/src/server/org/opends/server/backends/jeb/JebFormat.java | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/JebFormat.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/JebFormat.java
index 9813c65..fabaa25 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/JebFormat.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/JebFormat.java
@@ -63,6 +63,7 @@
*
* @param bytes The database value of the entry ID.
* @return The entry ID value.
+ * @see #entryIDToDatabase(long)
*/
public static long entryIDFromDatabase(byte[] bytes)
{
@@ -100,6 +101,8 @@
*
* @param bytes The database value of the entry ID count.
* @return The entry ID count.
+ * Cannot be negative if encoded with #entryIDUndefinedSizeToDatabase(long)
+ * @see #entryIDUndefinedSizeToDatabase(long)
*/
public static long entryIDUndefinedSizeFromDatabase(byte[] bytes)
{
@@ -110,7 +113,14 @@
if(bytes.length == 8)
{
- return entryIDFromDatabase(bytes);
+ long v = 0;
+ v |= (bytes[0] & 0x7F);
+ for (int i = 1; i < 8; i++)
+ {
+ v <<= 8;
+ v |= (bytes[i] & 0xFF);
+ }
+ return v;
}
return Long.MAX_VALUE;
}
@@ -122,8 +132,8 @@
* hence no entry IDs. Note that this method will throw an
* ArrayIndexOutOfBoundsException if the bytes array length is
* not a multiple of 8.
- *
* @return An array of entry ID values.
+ * @see #entryIDListToDatabase(long[])
*/
public static long[] entryIDListFromDatabase(byte[] bytes)
{
@@ -174,8 +184,10 @@
/**
* Encode an entry ID value to its database representation.
+ *
* @param id The entry ID value to be encoded.
* @return The encoded database value of the entry ID.
+ * @see #entryIDFromDatabase(byte[])
*/
public static byte[] entryIDToDatabase(long id)
{
@@ -191,8 +203,10 @@
/**
* Encode an entry ID set count to its database representation.
+ *
* @param count The entry ID set count to be encoded.
- * @return The encoded database value of the entry ID.
+ * @return The encoded database value of the entry ID set count.
+ * @see #entryIDUndefinedSizeFromDatabase(byte[])
*/
public static byte[] entryIDUndefinedSizeToDatabase(long count)
{
@@ -211,8 +225,8 @@
* Encode an array of entry ID values to its database representation.
*
* @param entryIDArray An array of entry ID values.
- *
* @return The encoded database value.
+ * @see #entryIDListFromDatabase(byte[])
*/
public static byte[] entryIDListToDatabase(long[] entryIDArray)
{
@@ -248,6 +262,7 @@
* @param prefix The DN to prefix the deocded DN value.
* @return The decoded DN value.
* @throws DirectoryException if an error occurs while decoding the DN value.
+ * @see #dnToDNKey(DN, int)
*/
public static DN dnFromDNKey(byte[] dnKey, int offset, int length, DN prefix)
throws DirectoryException
@@ -332,6 +347,7 @@
* @param prefixRDNs The number of prefix RDNs to remove from the encoded
* representation.
* @return A DatabaseEntry containing the key.
+ * @see #dnFromDNKey(byte[], int, int, DN)
*/
public static byte[] dnToDNKey(DN dn, int prefixRDNs)
{
--
Gitblit v1.10.0