Java Object Serialize and Deserialize deserializeRaw(byte[] array)

Here you can find the source of deserializeRaw(byte[] array)

Description

deserialize Raw

License

Open Source License

Declaration

public static Serializable deserializeRaw(byte[] array) throws IOException, ClassNotFoundException 

Method Source Code


//package com.java2s;
/*// w  w  w .ja  v  a 2s.  c  o m
 * This file is part of SpoutPlugin.
 *
 * Copyright (c) 2011 Spout LLC <http://www.spout.org/>
 * SpoutPlugin is licensed under the GNU Lesser General Public License.
 *
 * SpoutPlugin is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * SpoutPlugin is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.io.ByteArrayInputStream;

import java.io.IOException;
import java.io.ObjectInputStream;

import java.io.Serializable;

public class Main {
    private static ByteArrayInputStream byteInput;
    private static ObjectInputStream objectInput;

    public static Serializable deserializeRaw(byte[] array) throws IOException, ClassNotFoundException {
        byteInput = new ByteArrayInputStream(array);
        objectInput = new ObjectInputStream(byteInput);
        Serializable o = (Serializable) objectInput.readObject();
        return o;
    }
}

Related

  1. deserializeObject(String dir)
  2. deSerializeObject(String str, Class cls)
  3. deserializeObjectFromByteArray(byte[] data)
  4. deserializeObjectFromByteArray(byte[] theSerializedVersion)
  5. deserializeProperties(byte[] bytes)
  6. deserializeSafe(byte[] buf, T obj)
  7. deserializeShort(byte[] inbuf, int offset)
  8. deserializeStream(final String witness)
  9. serializeAndDeserialize(Object o)