Returns value as a Byte List.

@param value array to convert.

@return value as a Byte List.
425978
private List<Byte> asByteList(Object value) {
        byte[] values = (byte[]) value;
        List<Byte> list = new ArrayList<Byte>(values.length);
        for (byte byteValue : values) {
            list.add(byteValue);
        }
        return list;
    }
562494
public static byte[] decompress(byte[] value) throws DataFormatException {
        // Create an expandable byte array to hold the decompressed data
        ByteArrayOutputStream bos = new ByteArrayOutputStream(value.length);
        Inflater decompressor = new Inflater();
        try {
            decompressor.setInput(value);
            final byte[] buf = new byte[1024];
            while (!decompressor.finished()) {
                int count = decompressor.inflate(buf);
                bos.write(buf, 0, count);
            }
        } finally {
            decompressor.end();
        }

        return bos.toByteArray();
    }
961196
protected<T> List<T> toList (T value) {

        if (value == null) {
            return null;
        }

        return Arrays.asList(value);
    }
872353
public static byte[] longToBytes(long val) {
    byte[] b = new byte[8];
    for (int i = 7; i > 0; i--) {
      b[i] = (byte) val;
      val >>>= 8;
    }
    b[0] = (byte) val;
    return b;
  }
277320
public static byte[] getBytes(long value) {
        return new byte[]{(byte) (value >> 56), (byte) (value >> 48), (byte) (value >> 40), (byte) (value >> 32),
                (byte) (value >> 24), (byte) (value >> 16), (byte) (value >> 8), (byte) value};
    }
987566
public static byte[] toUnsignedByteArray(BigInteger value) {
		byte[] bytes = value.toByteArray();

		if (bytes[0] == 0) {
			byte[] tmp = new byte[bytes.length - 1];
			System.arraycopy(bytes, 1, tmp, 0, tmp.length);

			return tmp;
		}

		return bytes;
	}
325977
public byte[] toBytes(@Nullable Object val)
  {
    if (val != null) {
      byte[] bytes = getObjectStrategy().toBytes(val);
      return bytes != null ? bytes : ByteArrays.EMPTY_ARRAY;
    } else {
      return ByteArrays.EMPTY_ARRAY;
    }
  }
372674
public static final byte[] toAsciiBytes(final String value) 
        {
        byte[] result = new byte[value.length()];
        for (int i = 0; i < value.length(); i++) 
            {
            result[i] = (byte) value.charAt(i);
            }
        return result;
        }
497911
@Pure
	public static byte[] parseBELong(long value) {
		return new byte[] {
			(byte) ((value >> 56) & 0xFF),
			(byte) ((value >> 48) & 0xFF),
			(byte) ((value >> 40) & 0xFF),
			(byte) ((value >> 32) & 0xFF),
			(byte) ((value >> 24) & 0xFF),
			(byte) ((value >> 16) & 0xFF),
			(byte) ((value >> 8) & 0xFF),
			(byte) (value & 0xFF),
		};
    }
845366
public byte[] getValueAsArray() {
        ByteBuffer buffer = getValue();
        byte[] result = new byte[buffer.remaining()];
        buffer.get(result);
        return result;
    }
1232771
public static byte[] objString2Byte(String value, Charset charset) {
        if (null == value) {
            return null;
        }
        // 获取byte
        return value.getBytes(charset);

    }
482236
private static byte[] intToByteArray(int value)
    {
        byte[] data = new byte[4];

        // int -> byte[]
        for (int i = 0; i < 4; ++i)
        {
            int shift = i << 3; // i * 8
            data[3 - i] = (byte) ((value & (0xff << shift)) >>> shift);
        }
        return data;
    }
637321
public static byte[] getBytesLittleEndian(long value) {
		byte[] b = new byte[8];
		b[0] = (byte)(value & 0xFF);
		b[1] = (byte)((value >> 8) & 0xFF);
		b[2] = (byte)((value >> 16) & 0xFF);
		b[3] = (byte)((value >> 24) & 0xFF);
		b[4] = (byte)((value >> 32) & 0xFF);
		b[5] = (byte)((value >> 40) & 0xFF);
		b[6] = (byte)((value >> 48) & 0xFF);
		b[7] = (byte)((value >> 56) & 0xFF);
		return b;
	}
841103
public byte[] toByteArray()
    {
        byte[] data = new byte[getSize()];
        int off = 0;
        for (MessageBuffer buffer : list) {
            buffer.getBytes(0, data, off, buffer.size());
            off += buffer.size();
        }
        return data;
    }
1167315
public static Buffer wrap(final int value) {
        final int size = value < 0 ? stringSize(-value) + 1 : stringSize(value);
        final byte[] bytes = new byte[size];
        getBytes(value, size, bytes);
        return new ByteBuffer(bytes);
    }
1092353
public static final byte[] asByteArray(WsByteBuffer[] list) {
        if (null == list)
            return null;
        int size = 0;
        for (int i = 0; i < list.length && null != list[i]; i++) {
            size += list[i].limit();
        }
        if (0 == size)
            return null;
        byte[] output = new byte[size];
        int offset = 0;
        int position = 0;
        for (int i = 0; i < list.length && null != list[i]; i++) {
            position = list[i].position();
            list[i].position(0);
            list[i].get(output, offset, list[i].limit());
            offset += list[i].limit();
            list[i].position(position);
        }
        return output;
    }
551838
public R toBytesArray(@Nullable Iterable<ByteArray> values) {
    return handle(Value.bytesArray(values));
  }