Java Serialize serializeInt(int i)

Here you can find the source of serializeInt(int i)

Description

serialize Int

License

Open Source License

Declaration

public static byte[] serializeInt(int i) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.ByteArrayOutputStream;

import java.io.DataOutputStream;
import java.io.IOException;

public class Main {
    public static byte[] serializeInt(int i) {
        ByteArrayOutputStream bos = new ByteArrayOutputStream(4);
        DataOutputStream dos = new DataOutputStream(bos);
        try {/* w  w  w.  ja  va 2s  .  co  m*/
            dos.writeInt(i);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return bos.toByteArray();
    }
}

Related

  1. serializedCopy(T object)
  2. serializeDistributionType(String distributionType, String HadoopDistribution)
  3. serializeExecutor(Object executor)
  4. serializeFromString(final String pString)
  5. serializeGZip(T obj)
  6. serializeInt2MinLE(int value)
  7. serializeInt2MinLE(int value)
  8. serializeIntLE(int value, byte[] outbuf, int offset)
  9. serializeJdk(Object obj)