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