org.jopendocument.util
Class StreamUtils

java.lang.Object
  extended by org.jopendocument.util.StreamUtils

public class StreamUtils
extends java.lang.Object


Field Summary
static java.io.OutputStream NULL_OS
           
 
Constructor Summary
StreamUtils()
           
 
Method Summary
static void copy(java.io.InputStream ins, java.io.File out)
           
static void copy(java.io.InputStream in, java.io.OutputStream out)
          Verbatim copy an entry from input to output stream.
static void copy(java.io.InputStream in, java.io.OutputStream out, int bufferSize)
           
static long copy(java.io.InputStream in, java.io.OutputStream out, int bufferSize, long length)
           
static java.io.Writer createXMLUnbufferedWriter(java.io.OutputStream outs)
           
static java.io.BufferedWriter createXMLWriter(java.io.OutputStream outs)
          Wrap the output stream into a writer, and write the XML declaration.
static void write(java.lang.String s, java.io.OutputStream out)
           
static void write(java.lang.String s, java.io.OutputStream out, java.nio.charset.Charset charset)
           
static void writeln(java.lang.String s, java.io.OutputStream out)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_OS

public static final java.io.OutputStream NULL_OS
Constructor Detail

StreamUtils

public StreamUtils()
Method Detail

copy

public static void copy(java.io.InputStream in,
                        java.io.OutputStream out)
                 throws java.io.IOException
Verbatim copy an entry from input to output stream.

Parameters:
in - the source.
out - the destination.
Throws:
java.io.IOException - if an error occurs while reading or writing.

copy

public static void copy(java.io.InputStream in,
                        java.io.OutputStream out,
                        int bufferSize)
                 throws java.io.IOException
Throws:
java.io.IOException

copy

public static long copy(java.io.InputStream in,
                        java.io.OutputStream out,
                        int bufferSize,
                        long length)
                 throws java.io.IOException
Throws:
java.io.IOException

copy

public static void copy(java.io.InputStream ins,
                        java.io.File out)
                 throws java.io.IOException
Throws:
java.io.IOException

writeln

public static void writeln(java.lang.String s,
                           java.io.OutputStream out)
                    throws java.io.IOException
Throws:
java.io.IOException

write

public static void write(java.lang.String s,
                         java.io.OutputStream out)
                  throws java.io.IOException
Throws:
java.io.IOException

write

public static void write(java.lang.String s,
                         java.io.OutputStream out,
                         java.nio.charset.Charset charset)
                  throws java.io.IOException
Throws:
java.io.IOException

createXMLWriter

public static java.io.BufferedWriter createXMLWriter(java.io.OutputStream outs)
                                              throws java.io.IOException
Wrap the output stream into a writer, and write the XML declaration.

Parameters:
outs - an output stream.
Returns:
a writer with the same encoding as the XML.
Throws:
java.io.IOException - if an error occurs.

createXMLUnbufferedWriter

public static java.io.Writer createXMLUnbufferedWriter(java.io.OutputStream outs)
                                                throws java.io.IOException
Throws:
java.io.IOException