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

com.acgist.snail.utils.ByteUtils Maven / Gradle / Ivy

Go to download

基于Java开发的下载工具,支持下载协议:BT(BitTorrent、磁力链接、种子文件)、HLS(M3U8)、FTP、HTTP。

There is a newer version: 2.17.0
Show newest version
package com.acgist.snail.utils;

import java.nio.ByteBuffer;

/**
 * 

字符工具

* * @author acgist */ public final class ByteUtils { private ByteUtils() { } /** *

读取剩余字节数据

* * @param buffer 缓冲数据 * * @return 剩余字节数据 */ public static final byte[] remainingToBytes(ByteBuffer buffer) { final byte[] bytes = new byte[buffer.remaining()]; buffer.get(bytes); return bytes; } /** *

读取剩余字节数据转为字符串

* * @param buffer 缓冲数据 * * @return 剩余字节数据字符串 */ public static final String remainingToString(ByteBuffer buffer) { return new String(remainingToBytes(buffer)); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy