All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.andyshao.util.ByteBuffereTools Maven / Gradle / Ivy

There is a newer version: 4.0
Show newest version
package com.github.andyshao.util;

import java.nio.ByteBuffer;

import com.github.andyshao.convert.Convert;

/**
 * 
 * Descript:
* Copyright: Copyright(c) Aug 4, 2014
* Encoding:UNIX UTF-8 * * @author Andy.Shao * */ public final class ByteBuffereTools { @Deprecated public static String byte2Hex(byte[] bs) { StringBuilder builder = new StringBuilder(); for (byte b : bs) { builder.append(Convert.BYTE_2_HEX.convert(b)); } return builder.toString(); } /** * Only return a space which great than buffer.position() and less than * buffer.limit() * * @param buffer the buffer which has the info * @return return the byte array and the info in it */ public static byte[] usedArray(ByteBuffer buffer) { return ArrayTools.splitArray(buffer.array() , buffer.position() , buffer.limit()); } private ByteBuffereTools() { throw new AssertionError("No support instance " + ByteBuffereTools.class.getName()); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy