Java InputStream Deserialize to Object deserializeInt(InputStream in)

Here you can find the source of deserializeInt(InputStream in)

Description

deserialize Int

License

Open Source License

Declaration

public static Integer deserializeInt(InputStream in) 

Method Source Code


//package com.java2s;
/* /*from  w  w w . j  a va 2  s  .com*/
 * This file is part of the HyperGraphDB source distribution. This is copyrighted 
 * software. For permitted uses, licensing options and redistribution, please see  
 * the LicensingInformation file at the root level of the distribution.  
 * 
 * Copyright (c) 2005-2010 Kobrix Software, Inc.  All rights reserved. 
 */

import java.io.IOException;
import java.io.InputStream;

public class Main {
    public static Integer deserializeInt(InputStream in) {
        try {
            int ch1 = in.read();
            int ch2 = in.read();
            int ch3 = in.read();
            int ch4 = in.read();
            int i = ((ch1 & 0xFF) << 24) | ((ch2 & 0xFF) << 16) | ((ch3 & 0xFF) << 8) | (ch4 & 0xFF);

            return new Integer(i);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        return null;
    }
}

Related

  1. deserialize(InputStream sourceInputStream, Class objectType)
  2. deserialize(ObjectInputStream stream)
  3. deserialize(String input, Class tClass)
  4. deserializeFromStram(InputStream inputStram)
  5. deserializeFromStream(ObjectInputStream in)
  6. deserializeSpecial(InputStream is, Class clazz)
  7. deserializeUUID(InputStream in)