ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( buffer.array(), buffer.position(), len ) );
try
{
ParentIdAndRdn parentIdAndRdn = new ParentIdAndRdn();
// Read the number of rdns, if any
byte nbRdns = in.readByte();
if ( nbRdns == 0 )
{
parentIdAndRdn.setRdns( new Rdn[0] );
}
else
{
Rdn[] rdns = new Rdn[nbRdns];
for ( int i = 0; i < nbRdns; i++ )
{
Rdn rdn = new Rdn( schemaManager );
rdn.readExternal( in );
rdns[i] = rdn;
}
parentIdAndRdn.setRdns( rdns );
}
// Read the parent ID
String uuid = in.readUTF();
parentIdAndRdn.setParentId( uuid );
// Read the nulber of children and descendants
int nbChildren = in.readInt();
int nbDescendants = in.readInt();
parentIdAndRdn.setNbChildren( nbChildren );
parentIdAndRdn.setNbDescendants( nbDescendants );
buffer.position( buffer.position() + len );
return parentIdAndRdn;
}