org.gcube.contentmanagement.util.stream
Class StreamUtils

java.lang.Object
  extended by org.gcube.contentmanagement.util.stream.StreamUtils

public class StreamUtils
extends java.lang.Object

The Class StreamUtils.


Constructor Summary
StreamUtils()
           
 
Method Summary
static void append(java.io.InputStream in, java.io.OutputStream out)
          Copy.
static void appendTo(java.io.File file, java.io.File newContent)
          Append to.
static boolean areEqual(java.io.InputStream in1, java.io.InputStream in2)
          Are equal.
static void copy(java.io.File inFile, java.io.File outFile)
          Copy.
static void copy(java.io.InputStream in, java.io.OutputStream out)
          Copy.
static void copy(java.io.InputStream in, java.io.OutputStream out, long offset)
          Copy.
static void copy(java.io.InputStream in, java.io.OutputStream out, long offset, long length)
          Copy.
static void copy(java.io.Reader in, java.io.Writer out, int offset)
          Copy.
static void copyFromFile(java.io.File f, java.io.OutputStream out)
          Copy from file.
static void copyToFile(java.io.InputStream in, java.io.File f)
          Copy to file.
static void extractPart(java.io.File inFile, java.io.File outFile, long offset, long length)
          Extract part.
static void main(java.lang.String[] args)
          The main method.
static java.lang.String stringFromFile(java.io.File f, java.nio.charset.Charset encoding)
          This function is only appropriate for character data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamUtils

public StreamUtils()
Method Detail

copy

public static void copy(java.io.File inFile,
                        java.io.File outFile)
                 throws java.io.IOException
Copy.

Parameters:
inFile - the in file
outFile - the out file
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

extractPart

public static void extractPart(java.io.File inFile,
                               java.io.File outFile,
                               long offset,
                               long length)
                        throws java.io.IOException
Extract part.

Parameters:
inFile - the in file
outFile - the out file
offset - the offset
length - the length
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

copy

public static void copy(java.io.InputStream in,
                        java.io.OutputStream out,
                        long offset,
                        long length)
                 throws java.io.IOException
Copy.

Parameters:
in - the in
out - the out
offset - the offset
length - the length
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

copy

public static void copy(java.io.InputStream in,
                        java.io.OutputStream out,
                        long offset)
                 throws java.io.IOException
Copy.

Parameters:
in - the in
out - the out
offset - the offset
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

append

public static void append(java.io.InputStream in,
                          java.io.OutputStream out)
                   throws java.io.IOException
Copy.

Parameters:
in - the in
out - the out
offset - the offset
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

copy

public static void copy(java.io.InputStream in,
                        java.io.OutputStream out)
                 throws java.io.IOException
Copy.

Parameters:
in - the in
out - the out
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

areEqual

public static boolean areEqual(java.io.InputStream in1,
                               java.io.InputStream in2)
                        throws java.io.IOException
Are equal.

Parameters:
in1 - the in1
in2 - the in2
Returns:
true, if successful
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

copy

public static void copy(java.io.Reader in,
                        java.io.Writer out,
                        int offset)
                 throws java.io.IOException
Copy.

Parameters:
in - the in
out - the out
offset - the offset
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

copyToFile

public static void copyToFile(java.io.InputStream in,
                              java.io.File f)
                       throws java.io.IOException
Copy to file.

Parameters:
in - the in
f - the f
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

appendTo

public static void appendTo(java.io.File file,
                            java.io.File newContent)
                     throws java.io.IOException
Append to.

Parameters:
file - the file
newContent - the new content
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

copyFromFile

public static void copyFromFile(java.io.File f,
                                java.io.OutputStream out)
                         throws java.io.IOException
Copy from file.

Parameters:
f - the f
out - the out
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
The main method.

Parameters:
args - the arguments
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

stringFromFile

public static java.lang.String stringFromFile(java.io.File f,
                                              java.nio.charset.Charset encoding)
                                       throws java.io.IOException
This function is only appropriate for character data.

Parameters:
f - the f
encoding - the encoding
Returns:
the string
Throws:
java.io.IOException - Signals that an I/O exception has occurred.