public class ByteUtils
extends java.lang.Object
| 构造器和说明 |
|---|
ByteUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
concat(byte[] bytes1,
byte[] bytes2)
合并两个byte[]
|
static byte[] |
copy(byte[] bs) |
static byte[] |
inputStream2ByteArray(java.io.File file) |
static byte[] |
inputStream2ByteArray(java.lang.String filePath) |
static byte[] |
subBytes(byte[] bs,
int startIndex,
int length)
返回一个byte[]中指定的一部分。
|
static java.util.List<byte[]> |
subToSmallBytes(byte[] bs,
int minLength,
int maxLength)
subToSmallBytes
|
static java.util.List<byte[]> |
subToSmallBytes(java.io.File file,
int subLen)
使用流的方式将文件读取一遍,然后切分成小的数组返回,数组大小为一个固定的值。
|
static java.util.List<byte[]> |
subToSmallBytes(java.io.InputStream inputStream,
int subLen)
切分成小的数组返回,数组大小为一个固定的值。
|
public static byte[] subBytes(byte[] bs,
int startIndex,
int length)
bs - 原byte[]startIndex - 开始索引length - 要拷贝的字节长度System.arraycopy(Object, int, Object, int, int)public static byte[] copy(byte[] bs)
public static byte[] concat(byte[] bytes1,
byte[] bytes2)
bytes1 - 第一个byte[]bytes2 - 第二个byte[]java.lang.IllegalArgumentException - 如果任一参数为nullpublic static java.util.List<byte[]> subToSmallBytes(byte[] bs,
int minLength,
int maxLength)
bs - bsminLength - minLengthmaxLength - maxLengthpublic static java.util.List<byte[]> subToSmallBytes(java.io.File file,
int subLen)
throws java.io.FileNotFoundException
subToSmallBytes(byte[], int, int)方法快一点。file - 文件subLen - 切成指定的大小。java.io.FileNotFoundExceptionpublic static java.util.List<byte[]> subToSmallBytes(java.io.InputStream inputStream,
int subLen)
inputStream - inputStreamsubLen - subLenpublic static byte[] inputStream2ByteArray(java.lang.String filePath)
public static byte[] inputStream2ByteArray(java.io.File file)
Copyright © 2023. All rights reserved.