public class FileUtil extends Object
| Constructor and Description |
|---|
FileUtil(int bufferSize,
int startSize) |
| Modifier and Type | Method and Description |
|---|---|
static FileUtil |
create() |
byte[] |
readFile(File file)
Fills a byte array with the content of a file.
|
byte[] |
readStream(InputStream is)
Fills a byte array with the content of a stream.
|
byte[] |
readStream(InputStream is,
int customStartSize)
Fills a byte array with the content of a stream.
|
public FileUtil(int bufferSize,
int startSize)
bufferSize - the size of the copy bufferstartSize - the initial size of the byte arraypublic static FileUtil create()
public byte[] readFile(File file) throws IOException
file - the file to readIOException - if an I/O occurspublic byte[] readStream(InputStream is) throws IOException
is - the stream to readIOException - if an I/O occurspublic byte[] readStream(InputStream is, int customStartSize) throws IOException
is - the stream to readcustomStartSize - the initial size of the byte array, e.g the length of the fileIOException - if an I/O occursCopyright © 2016–2021. All rights reserved.