org.gcube.contentmanagement.baselayer.networkFileTransfer
Class StreamUtils
java.lang.Object
org.gcube.contentmanagement.baselayer.networkFileTransfer.StreamUtils
public class StreamUtils
- extends java.lang.Object
Method Summary |
static void |
appendTo(java.io.File file,
java.io.File newContent)
|
static boolean |
areEqual(java.io.InputStream in1,
java.io.InputStream in2)
|
static void |
copy(java.io.File inFile,
java.io.File outFile)
|
static void |
copy(java.io.InputStream in,
java.io.OutputStream out)
|
static void |
copy(java.io.InputStream in,
java.io.OutputStream out,
long offset)
|
static void |
copy(java.io.InputStream in,
java.io.OutputStream out,
long offset,
long length)
|
static void |
copy(java.io.Reader in,
java.io.Writer out,
int offset)
|
static void |
copyFromFile(java.io.File f,
java.io.OutputStream out)
|
static void |
copyToFile(java.io.InputStream in,
java.io.File f)
|
static void |
extractPart(java.io.File inFile,
java.io.File outFile,
long offset,
long length)
|
static java.lang.String |
stringFromFile(java.io.File f,
java.nio.charset.Charset encoding)
Returns the content of a file as a String. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StreamUtils
public StreamUtils()
copy
public static void copy(java.io.File inFile,
java.io.File outFile)
throws java.io.IOException
- Throws:
java.io.IOException
extractPart
public static void extractPart(java.io.File inFile,
java.io.File outFile,
long offset,
long length)
throws java.io.IOException
- Throws:
java.io.IOException
copy
public static void copy(java.io.InputStream in,
java.io.OutputStream out,
long offset,
long length)
throws java.io.IOException
- Throws:
java.io.IOException
copy
public static void copy(java.io.InputStream in,
java.io.OutputStream out,
long offset)
throws java.io.IOException
- Throws:
java.io.IOException
copy
public static void copy(java.io.InputStream in,
java.io.OutputStream out)
throws java.io.IOException
- Throws:
java.io.IOException
areEqual
public static boolean areEqual(java.io.InputStream in1,
java.io.InputStream in2)
throws java.io.IOException
- Throws:
java.io.IOException
copy
public static void copy(java.io.Reader in,
java.io.Writer out,
int offset)
throws java.io.IOException
- Throws:
java.io.IOException
copyToFile
public static void copyToFile(java.io.InputStream in,
java.io.File f)
throws java.io.IOException
- Throws:
java.io.IOException
appendTo
public static void appendTo(java.io.File file,
java.io.File newContent)
throws java.io.IOException
- Throws:
java.io.IOException
copyFromFile
public static void copyFromFile(java.io.File f,
java.io.OutputStream out)
throws java.io.IOException
- Throws:
java.io.IOException
stringFromFile
public static java.lang.String stringFromFile(java.io.File f,
java.nio.charset.Charset encoding)
throws java.io.IOException
- Returns the content of a file as a String. The file contents are interpreted according
to a given encoding. Note: This function is only appropriate for character data.
- Parameters:
f
- the fileencoding
- the encoding
- Returns:
- a string containing the file content
- Throws:
java.io.IOException