ERR_JEB_INCOMPATIBLE_ENTRY_VERSION.get(formatVersion);
throw new ASN1Exception(message);
}
// Read the ASN1 sequence.
ASN1Reader reader = ASN1.getReader(bytes.subSequence(1, bytes.length()));
reader.readStartSequence();
// See if it was compressed.
int uncompressedSize = (int)reader.readInteger();
if(uncompressedSize > 0)
{
// We will use the cached buffers to avoid allocations.
// Reset the buffers;
entryBuffer.clear();
compressedEntryBuffer.clear();
// It was compressed.
reader.readOctetString(compressedEntryBuffer);
CryptoManager cryptoManager = DirectoryServer.getCryptoManager();
// TODO: Should handle the case where uncompress returns < 0
compressedEntryBuffer.uncompress(entryBuffer, cryptoManager,
uncompressedSize);
// Since we are used the cached buffers (ByteStringBuilders),
// the decoded attribute values will not refer back to the
// original buffer.
return Entry.decode(entryBuffer.asReader(), compressedSchema);
}
else
{
// Since we don't have to do any decompression, we can just decode
// the entry off the
ByteString encodedEntry = reader.readOctetString();
return Entry.decode(encodedEntry.asReader(), compressedSchema);
}
}