Code example for ByteArrayInputStream

Methods: close

0
		return bytes;
	} 
 
	public static Object getObject(byte[] bytes) throws IOException,
			ClassNotFoundException { 
		ByteArrayInputStream bi = new ByteArrayInputStream(bytes);
		ObjectInputStream oi = new ObjectInputStream(bi);
		Object obj = oi.readObject();
		bi.close();
		oi.close();
		return obj;
	} 
 
	public static ByteBuffer getByteBuffer(Object obj) throws IOException {
		byte[] bytes = JDKSerializeUtil.getBytes(obj);
		ByteBuffer buff = ByteBuffer.wrap(bytes);
 
		return buff;
	} 
}