public class StreamUtil extends Object
| Constructor and Description |
|---|
StreamUtil() |
| Modifier and Type | Method and Description |
|---|---|
static long |
calcCRC(InputStream in) |
static void |
copy(File in,
File out)
Copies one file to another.
|
static void |
copy(File in,
OutputStream out) |
static void |
copy(InputStream in,
File outputFile)
Copies an
InputStream to a File. |
static void |
copy(InputStream is,
OutputStream outputStream)
Copies an
InputStream to an OutputStream. |
static void |
copy(InputStream is,
String outputPath)
Copies an
InputStream to a File. |
static void |
copy(ReadableByteChannel inChannel,
WritableByteChannel outChannel)
Copies a
ReadableByteChannel to a WritableByteChannel. |
static void |
copy(ReadableByteChannel inChannel,
WritableByteChannel outChannel,
boolean closeChannels)
Copies a
ReadableByteChannel to a WritableByteChannel. |
static void |
copy(String fromPath,
String toPath,
boolean move)
Copies a file from one location to another.
|
static FileCachedInputStream |
createResettableStream(InputStream is,
int bufferSize) |
static byte[] |
inputStreamToBytes(InputStream in)
Reads an InputStream into an array of bytes.
|
boolean |
isCompressed(byte[] bytes) |
static String |
streamAsString(InputStream in,
String encoding) |
static String |
streamUtf8AsString(InputStream in) |
static InputStream |
stringAsStream(String str,
String encoding) |
public static byte[] inputStreamToBytes(InputStream in) throws IOException
in - the input stream to read.IOException - if an error occurs.public static void copy(File in, OutputStream out)
public static String streamAsString(InputStream in, String encoding)
public static String streamUtf8AsString(InputStream in)
public static InputStream stringAsStream(String str, String encoding)
public static long calcCRC(InputStream in)
public static void copy(ReadableByteChannel inChannel, WritableByteChannel outChannel)
ReadableByteChannel to a WritableByteChannel.inChannel - the input Channel.outChannel - the output Channel.OkapiIOException - if an error occurs.public static void copy(ReadableByteChannel inChannel, WritableByteChannel outChannel, boolean closeChannels)
ReadableByteChannel to a WritableByteChannel.inChannel - the input Channel.outChannel - the output Channel.closeChannels - close in and out channels?OkapiIOException - if an error occurs.public static void copy(InputStream in, File outputFile)
InputStream to a File.in - the input stream.outputFile - the output File.OkapiIOException - if an error occurs.public static void copy(InputStream is, String outputPath)
InputStream to a File.is - the input stream.outputPath - the output path.OkapiIOException - if an error occurs.public static void copy(InputStream is, OutputStream outputStream)
InputStream to an OutputStream.is - the input stream.outputStream - the output stream.OkapiIOException - if an error occurs.public static void copy(File in, File out)
in - the input file.out - the output file.OkapiIOException - if an error occurs.public static void copy(String fromPath, String toPath, boolean move)
fromPath - the path of the file to copy.toPath - the path of the copy to make.move - true to move the file, false to copy it.OkapiIOException - if an error occurs.public static FileCachedInputStream createResettableStream(InputStream is, int bufferSize) throws IOException
IOExceptionpublic boolean isCompressed(byte[] bytes)
Copyright © 2021. All rights reserved.