public class FileToBytes extends Object
将文件转换成一个二进制数据(byte)
File to binary tool class
Convert file to a binary data (byte)
program: Sinlmao Commons Network Utils
description: 文件转换为Bytes数据
create: 2019-09-02 11:48
| 构造器和说明 |
|---|
FileToBytes() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
File2ByteArray(File file)
将文件(File)转换成二进制数据(byte)
Convert a file to binary data
|
static byte[] |
File2ByteArray(String filePath)
将文件(File)转换成二进制数据(byte)
Convert a file to binary data
|
static byte[] |
InputStream2ByteArray(InputStream in)
将InputStream(输入流)转换成byte数组
Convert an InputStream to a byte array
|
public static byte[] File2ByteArray(String filePath) throws IOException
Convert a file to binary data
filePath - 文件路径 IOException - IO异常 public static byte[] File2ByteArray(File file) throws IOException
Convert a file to binary data
file - 文件实体对象 IOException - IO异常 public static byte[] InputStream2ByteArray(InputStream in) throws IOException
Convert an InputStream to a byte array
in - 输入流 IOException - IO异常 Copyright © 2020. All rights reserved.