|
Oracle® Fusion Middleware Java API Reference for Oracle WebCenter Content Remote Intradoc Client (RIDC) 11g Release 1 (11.1) E17274-04 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.stellent.ridc.common.util.StreamUtil
public class StreamUtil
Utility methods for working with streams
Constructor Summary | |
---|---|
StreamUtil() |
Method Summary | |
---|---|
static void |
closeReader(Reader reader) Close a reader, ignoring any exceptions that occur during the close |
static void |
closeStream(InputStream stream) Close a stream, ignoring any exceptions that occur during the close |
static void |
closeStream(OutputStream stream) Close a stream, ignoring any exceptions that occur during the close |
static void |
closeWriter(Writer writer) Close a writer, ignoring any exceptions that occur during the close |
static void |
copyReader(Reader reader, Writer writer, boolean closeInput, boolean closeOutput) Copy the contents of the Reader to the Writer |
static void |
copyStream(InputStream inputStream, OutputStream outputStream, boolean closeInput, boolean closeOutput) Copy the contents of the inputstream to the outputstream |
static String |
getStringFromFile(File file) Convert the contents of the file into a string |
static String |
getStringFromFile(File file, String encoding) Convert the contents of the file into a string |
static String |
getStringFromStream(InputStream stream) Read the stream and create a string using the default system encoding |
static String |
getStringFromStream(InputStream stream, String encoding) Read the stream and create a string from the contents, using the given encoding |
static String |
readLine(InputStream inputStream, String charset) This code copied from HttpClient. |
static byte[] |
readRawLine(InputStream inputStream) This code copied from HttpClient. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StreamUtil()
Method Detail |
---|
public static void copyStream(InputStream inputStream, OutputStream outputStream, boolean closeInput, boolean closeOutput) throws IOException
inputStream
- the inputstream to readoutputStream
- the outputstream to write tocloseInput
- true to close the inputstream on completioncloseOutput
- true to close the outputstream on completionIOException
- if an IO error occurspublic static void copyReader(Reader reader, Writer writer, boolean closeInput, boolean closeOutput) throws IOException
reader
- the Reader to readwriter
- the Writer to write tocloseInput
- true to close the inputstream on completioncloseOutput
- true to close the outputstream on completionIOException
- if an IO error occurspublic static void closeStream(InputStream stream)
stream
- the stream to closepublic static void closeStream(OutputStream stream)
stream
- the stream to closepublic static void closeReader(Reader reader)
reader
- the reader to closepublic static void closeWriter(Writer writer)
writer
- the writer to closepublic static String getStringFromFile(File file) throws IOException
file
- the file to readIOException
public static String getStringFromFile(File file, String encoding) throws IOException
file
- the file to readencoding
- the character encoding to useIOException
public static String getStringFromStream(InputStream stream) throws IOException
stream
- the stream to readIOException
public static String getStringFromStream(InputStream stream, String encoding) throws IOException
stream
- the inputstream to readencoding
- the encoding to useIOException
public static byte[] readRawLine(InputStream inputStream) throws IOException
null
is returned.inputStream
- the stream to read fromIOException
- if an I/O problem occurspublic static String readLine(InputStream inputStream, String charset) throws IOException
Read up to "\n" from an (unchunked) input stream. If the stream ends before the line terminator is found, the last part of the string will still be returned. If no input data available, null
is returned.
inputStream
- the stream to read fromcharset
- charset of HTTP protocol elementsIOException
- if an I/O problem occurs
|
Oracle® Fusion Middleware Java API Reference for Oracle WebCenter Content Remote Intradoc Client (RIDC) 11g Release 1 (11.1) E17274-04 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |