public final class Streams
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
asString(java.io.InputStream pStream)
This convenience method allows to read a
FileItemStream 's
content into a string. |
static java.lang.String |
asString(java.io.InputStream pStream,
java.lang.String pEncoding)
This convenience method allows to read a
FileItemStream 's
content into a string, using the given character encoding. |
static java.lang.String |
checkFileName(java.lang.String pFileName)
Checks, whether the given file name is valid in the sense,
that it doesn't contain any NUL characters.
|
static long |
copy(java.io.InputStream pInputStream,
java.io.OutputStream pOutputStream,
boolean pClose)
Copies the contents of the given
InputStream
to the given OutputStream . |
static long |
copy(java.io.InputStream pIn,
java.io.OutputStream pOut,
boolean pClose,
byte[] pBuffer)
Copies the contents of the given
InputStream
to the given OutputStream . |
public static long copy(java.io.InputStream pInputStream, java.io.OutputStream pOutputStream, boolean pClose) throws java.io.IOException
InputStream
to the given OutputStream
. Shortcut for
copy(pInputStream, pOutputStream, new byte[8192]);
pInputStream
- The input stream, which is being read.
It is guaranteed, that InputStream.close()
is called
on the stream.pOutputStream
- The output stream, to which data should
be written. May be null, in which case the input streams
contents are simply discarded.pClose
- True guarantees, that OutputStream.close()
is called on the stream. False indicates, that only
OutputStream.flush()
should be called finally.java.io.IOException
- An I/O error occurred.public static long copy(java.io.InputStream pIn, java.io.OutputStream pOut, boolean pClose, byte[] pBuffer) throws java.io.IOException
InputStream
to the given OutputStream
.pIn
- The input stream, which is being read.
It is guaranteed, that InputStream.close()
is called
on the stream.pOut
- The output stream, to which data should
be written. May be null, in which case the input streams
contents are simply discarded.pClose
- True guarantees, that OutputStream.close()
is called on the stream. False indicates, that only
OutputStream.flush()
should be called finally.pBuffer
- Temporary buffer, which is to be used for
copying data.java.io.IOException
- An I/O error occurred.public static java.lang.String asString(java.io.InputStream pStream) throws java.io.IOException
FileItemStream
's
content into a string. The platform's default character encoding
is used for converting bytes into characters.pStream
- The input stream to read.java.io.IOException
- An I/O error occurred.asString(InputStream, String)
public static java.lang.String asString(java.io.InputStream pStream, java.lang.String pEncoding) throws java.io.IOException
FileItemStream
's
content into a string, using the given character encoding.pStream
- The input stream to read.pEncoding
- The character encoding, typically "UTF-8".java.io.IOException
- An I/O error occurred.asString(InputStream)
public static java.lang.String checkFileName(java.lang.String pFileName)
InvalidFileNameException
is raised.pFileName
- The file name to checkInvalidFileNameException
- The file name was found to be invalid.Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.