Deserializes an object from an input stream. : InputStream « File Input Output « Java

Deserializes an object from an input stream.

 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.

public class Main {

   * This method deserializes an object from an input stream.
   * @param file The input file
   * @return The deserialized object
   * @exception IOException IOError
  public static Object deserializeObject(File file)
  throws IOException, ClassNotFoundException {
      FileInputStream fis = new FileInputStream(file);
      Object object = null;
      try {
          ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(fis));
          object = ois.readObject();
      } finally {
      return object;



Related examples in the same category

1.Creating an input or output stream on a ByteBuffer
2.Creating a Manifest for a JAR File
3.Convert InputStream to String
4.An limited-data-size input stream
5.An input stream which reads sequentially from multiple sources
6.Combined InputStream
7.Size Limit InputStream
8.Minimal InputStream subclass to fetch bytes form a String
9.Read and return the entire contents of the supplied InputStream. This method always closes the stream when finished reading.
10.Compare two InputStream
11.Read and return the entire contents of the supplied InputStream.
12.Reads at most certain bytes from input stream and returns them as a byte array.
13.Convert Reader to InputStream
14.A trace of the data that is being retrieved from an input stream
15.EOLConvertingInputStream: InputStream which converts \r bytes not followed by \n and \n not preceded by \r to \r\n.
16.A line reading wrapper that works with byte streams.
17.Smart Encoding InputStream
18.Wraps a stream that has been exported to import the data in readable form
19.This input stream wrapper closes the base input stream when fully read.
20.LZFInputStream and LZFOutputStream
21.Random input stream