Skip navigation links

Oracle® Fusion Middleware Content Integration Suite (CIS) Java API Reference
11g Release 1 (11.1)

E17350-01


com.stellent.cis.common.util
Class StreamUtil

java.lang.Object
  extended by com.stellent.cis.common.util.StreamUtil


public class StreamUtil
extends java.lang.Object

Utility methods for working with streams


Constructor Summary
StreamUtil()
           

 

Method Summary
static void closeReader(java.io.Reader reader)
          Close a reader, ignoring any exceptions that occur during the close
static void closeStream(java.io.InputStream stream)
          Close a stream, ignoring any exceptions that occur during the close
static void closeStream(java.io.OutputStream stream)
          Close a stream, ignoring any exceptions that occur during the close
static void closeWriter(java.io.Writer writer)
          Close a writer, ignoring any exceptions that occur during the close
static void copyReader(java.io.Reader reader, java.io.Writer writer, boolean closeInput, boolean closeOutput)
          Copy the contents of the Reader to the Writer
static void copyStream(java.io.InputStream inputStream, java.io.OutputStream outputStream, boolean closeInput, boolean closeOutput)
          Copy the contents of the inputstream to the outputstream
static java.lang.String getStringFromFile(java.io.File file)
          Convert the contents of the file into a string
static java.lang.String getStringFromFile(java.io.File file, java.lang.String encoding)
          Convert the contents of the file into a string
static java.lang.String getStringFromStream(java.io.InputStream stream)
          Read the stream and create a string using the default system encoding
static java.lang.String getStringFromStream(java.io.InputStream stream, java.lang.String encoding)
          Read the stream and create a string from the contents, using the given encoding

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

StreamUtil

public StreamUtil()

Method Detail

copyStream

public static void copyStream(java.io.InputStream inputStream,
                              java.io.OutputStream outputStream,
                              boolean closeInput,
                              boolean closeOutput)
                       throws java.io.IOException
Copy the contents of the inputstream to the outputstream
Parameters:
inputStream - the inputstream to read
outputStream - the outputstream to write to
closeInput - true to close the inputstream on completion
closeOutput - true to close the outputstream on completion
Throws:
java.io.IOException - if an IO error occurs

copyReader

public static void copyReader(java.io.Reader reader,
                              java.io.Writer writer,
                              boolean closeInput,
                              boolean closeOutput)
                       throws java.io.IOException
Copy the contents of the Reader to the Writer
Parameters:
reader - the Reader to read
writer - the Writer to write to
closeInput - true to close the inputstream on completion
closeOutput - true to close the outputstream on completion
Throws:
java.io.IOException - if an IO error occurs

closeStream

public static void closeStream(java.io.InputStream stream)
Close a stream, ignoring any exceptions that occur during the close
Parameters:
stream - the stream to close

closeStream

public static void closeStream(java.io.OutputStream stream)
Close a stream, ignoring any exceptions that occur during the close
Parameters:
stream - the stream to close

closeReader

public static void closeReader(java.io.Reader reader)
Close a reader, ignoring any exceptions that occur during the close
Parameters:
reader - the reader to close

closeWriter

public static void closeWriter(java.io.Writer writer)
Close a writer, ignoring any exceptions that occur during the close
Parameters:
writer - the writer to close

getStringFromFile

public static java.lang.String getStringFromFile(java.io.File file)
                                          throws java.io.IOException
Convert the contents of the file into a string
Parameters:
file - the file to read
Returns:
a string containing the file contents, using the default character encoding on the JVM
Throws:
java.io.IOException

getStringFromFile

public static java.lang.String getStringFromFile(java.io.File file,
                                                 java.lang.String encoding)
                                          throws java.io.IOException
Convert the contents of the file into a string
Parameters:
file - the file to read
encoding - the character encoding to use
Returns:
a string containing the file contents, using the default character encoding on the JVM
Throws:
java.io.IOException

getStringFromStream

public static java.lang.String getStringFromStream(java.io.InputStream stream)
                                            throws java.io.IOException
Read the stream and create a string using the default system encoding
Parameters:
stream - the stream to read
Returns:
a string containing the streams contents
Throws:
java.io.IOException

getStringFromStream

public static java.lang.String getStringFromStream(java.io.InputStream stream,
                                                   java.lang.String encoding)
                                            throws java.io.IOException
Read the stream and create a string from the contents, using the given encoding
Parameters:
stream - the inputstream to read
encoding - the encoding to use
Returns:
the string containing the stream contents
Throws:
java.io.IOException

Skip navigation links

Oracle® Fusion Middleware Content Integration Suite (CIS) Java API Reference
11g Release 1 (11.1)

E17350-01


Copyright © 1996, 2010, Oracle and/or its affiliates. All rights reserved.