public class StreamUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
copyStreamToFile(java.io.InputStream inStream,
java.io.File outFile)
Copies an input stream to a file until end of stream.
|
static boolean |
copyStreamToFile(java.io.InputStream inStream,
java.io.File outFile,
boolean append)
Copies an input stream to a file until end of stream.
|
static boolean |
copyStreamToStream(java.io.InputStream inStream,
java.io.OutputStream outStream)
Copies an input stream to the output stream until end of stream.
|
static java.lang.String |
copyStreamToString(java.io.InputStream inStream)
Copies an input stream to a string until end of stream.
|
static java.io.File |
copyStreamToTempFile(java.io.InputStream inStream)
Copies an input stream to a temporary file until end of stream.
|
static int |
ensureRead(java.io.InputStream in,
byte[] b,
int off,
int len)
Works similarly to
InputStream but ensures that len is read, or returns -1 if EOS. |
public static boolean copyStreamToStream(java.io.InputStream inStream, java.io.OutputStream outStream)
inStream
- outStream
- public static java.lang.String copyStreamToString(java.io.InputStream inStream)
inStream
- public static boolean copyStreamToFile(java.io.InputStream inStream, java.io.File outFile)
inStream
- outFile
- public static boolean copyStreamToFile(java.io.InputStream inStream, java.io.File outFile, boolean append)
inStream
- outFile
- append
- public static java.io.File copyStreamToTempFile(java.io.InputStream inStream)
inStream
- public static int ensureRead(java.io.InputStream in, byte[] b, int off, int len) throws java.io.IOException
InputStream
but ensures that len is read, or returns -1 if EOS.in
- the InputStream to read from.b
- the buffer into which the data is read.off
- the start offset in array b
at which the data is written.len
- The maximum number of bytes to read.-1
if there is no more data because the
end of the stream has been reached.java.io.IOException
InputStream}
Copyright © 2004-2020 FEUP-LSTS and Neptus developers. All Rights Reserved.