@SuppressWarnings("unchecked") public static <ValueT>ValueT toObject(ByteBuffer bf) throws IOException, ClassNotFoundException {
  Object obj=null;
  InputStream is=null;
  ObjectInputStream ois=null;
  try {
    is=new ByteBufferBackedInputStream(bf);
    ois=new ObjectInputStream(is);
    obj=ois.readObject();
  }
  finally {
    if (is != null) {
      is.close();
    }
    if (ois != null) {
      ois.close();
    }
  }
  return (ValueT)obj;
}

@ SuppressWarnings ( "unchecked" ) public static < ValueT > ValueT toObject ( ByteBuffer bf ) throws IOException , ClassNotFoundException { Object obj = null ; InputStream is = null ; ObjectInputStream ois = null ; try { is = new ByteBufferBackedInputStream ( bf ) ; ois = new ObjectInputStream ( is ) ; obj = ois . readObject ( ) ; } finally { if ( is != null ) { is . close ( ) ; } if ( ois != null ) { ois . close ( ) ; } } return ( ValueT ) obj ; }
de - serialize an object from a bytebuffer object .
