Java OutputStream Write serializeInt(OutputStream out, Integer data)

Here you can find the source of serializeInt(OutputStream out, Integer data)

Description

serialize Int

License

Open Source License

Declaration

public static void serializeInt(OutputStream out, Integer data) 

Method Source Code


//package com.java2s;
/* /*from   w w  w . j av a  2s  .c om*/
 * 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.OutputStream;

public class Main {
    public static void serializeInt(OutputStream out, Integer data) {
        // assume not null
        try {
            int v = ((Integer) data).intValue();
            out.write((byte) ((v >>> 24) & 0xFF));
            out.write((byte) ((v >>> 16) & 0xFF));
            out.write((byte) ((v >>> 8) & 0xFF));
            out.write((byte) ((v >>> 0) & 0xFF));
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}

Related

  1. serialize(Serializable obj, ByteArrayOutputStream bout)
  2. serialize(Serializable obj, OutputStream outputStream)
  3. serialize(Serializable obj, OutputStream outputStream)
  4. serialize(Serializable s, OutputStream os)
  5. serializeInt(int i, DataOutputStream dout)
  6. serializeNull(DataOutputStream dout)
  7. serializeObject(OutputStream out, Object o)
  8. serializeShortLE(short value, OutputStream outStream)
  9. serializeSpecial(OutputStream os, Serializable obj)