Java Byte Array Encode encodeByteArray(DataOutputStream out, byte[] bytes)

Here you can find the source of encodeByteArray(DataOutputStream out, byte[] bytes)

Description

encode Byte Array

License

Apache License

Declaration

public static void encodeByteArray(DataOutputStream out, byte[] bytes) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static void encodeByteArray(DataOutputStream out, byte[] bytes) throws IOException {
        if (bytes == null) {
            out.writeInt(-1);//from  w  w  w.  j ava 2s .c  om
            return;
        }
        out.writeInt(bytes.length);
        out.write(bytes);
    }
}

Related

  1. encode(byte[] rawData)
  2. encode(byte[] source)
  3. encode(String prefix, byte[] buf, ZipOutputStream zos, File[] files)
  4. encodeAsUtf8(byte[] bytes)
  5. encodeBitString(byte[] in, OutputStream os)
  6. encodeBytes(byte[] source, int off, int len)
  7. encodeCompositeAlways(List bytesList)
  8. encodeDataWithCharsetInMetaTag(byte[] data)
  9. encodeHex(byte[] bytes)