Java Utililty Methods Byte Array to Object

List of utility methods to do Byte Array to Object

  1. HOME
  2. Java
  3. B
  4. Byte Array to Object

Description

The list of methods to do Byte Array to Object are organized into topic(s).

Method

Serializable deserialize(byte[] array)
deserialize
if (array == null) {
 return null;
try {
 return deserializeRaw(array);
} catch (IOException e) {
 e.printStackTrace();
 return null;
...
Object deserialize(byte[] b)
deserialize
Object obj = null;
ObjectInputStream oin = null;
try {
 ByteArrayInputStream bin = new ByteArrayInputStream(b);
 oin = new ObjectInputStream(bin);
 obj = oin.readObject();
 return obj;
} finally {
...
Object deserialize(byte[] blob)
Deserialise the specified blob into an Object and return it to the client.
if (blob == null) {
 throw new IllegalArgumentException("null blob to deserialize");
ByteArrayInputStream bstream = new ByteArrayInputStream(blob);
ObjectInputStream istream = new ObjectInputStream(bstream);
return istream.readObject();
Serializable deserialize(byte[] buf)
Returns the object deserialized from the given byte array.
ByteArrayInputStream bais = new ByteArrayInputStream(buf);
ObjectInputStream ois = new ObjectInputStream(bais);
try {
 return (Serializable) ois.readObject();
} catch (ClassNotFoundException ex) {
 ex.printStackTrace();
 throw new IllegalStateException(ex.getMessage());
} finally {
...
T deserialize(byte[] buf)
deserialize
try {
 ByteArrayInputStream bis = null;
 try {
 bis = new ByteArrayInputStream(buf);
 ObjectInputStream oin = null;
 try {
 oin = new ObjectInputStream(bis);
 return (T) oin.readObject();
...
Object[] deserialize(byte[] buffer, int count)
This method takes the given buffer and extracts count number of objects from it.
try {
 Object[] objects = new Object[count];
 ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
 ObjectInputStream ois = new ObjectInputStream(bais);
 for (int i = 0; i < count; i++)
 objects[i] = ois.readObject();
 ois.close();
 return objects;
...
Serializable deserialize(byte[] byteArray)
deserialize
return deserialize(byteArray, Thread.currentThread().getContextClassLoader());
T deserialize(byte[] byteArray)
deserialize
ObjectInputStream oip = null;
try {
 oip = new ObjectInputStream(new ByteArrayInputStream(byteArray));
 @SuppressWarnings("unchecked")
 T result = (T) oip.readObject();
 return result;
} catch (IOException e) {
 throw new IllegalArgumentException(e);
...
Object deserialize(byte[] bytes)
deserialize
if (bytes == null) {
 return null;
try {
 ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
 return ois.readObject();
} catch (IOException ex) {
 throw new IllegalArgumentException("Failed to deserialize object", ex);
...
Object deserialize(byte[] bytes)
Deserializes an object.
if ((bytes == null) || (bytes.length == 0))
 return null;
ByteArrayInputStream byteStream = new ByteArrayInputStream(bytes);
try {
 ObjectInputStream stream = new ObjectInputStream(byteStream);
 try {
 return stream.readObject();
 } finally {
...


AltStyle によって変換されたページ (->オリジナル) /