public class IOUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
closeQuietly(java.io.InputStream in)
Calls
IOUtils.closeQuietly(InputStream) |
static void |
closeQuietly(java.io.OutputStream out)
Calls
IOUtils.closeQuietly(OutputStream) |
static void |
closeQuietly(java.io.Reader reader)
Calls
IOUtils.closeQuietly(Reader) |
static void |
closeQuietly(java.io.Writer w)
Calls
IOUtils.closeQuietly(Writer) |
static void |
copy(java.io.Reader reader,
java.io.Writer writer) |
static void |
copyFile(java.io.File src,
java.io.File dest) |
static void |
copyStream(java.io.InputStream in,
java.io.OutputStream out)
Copies the content of the InputStream into the
OutputStream
|
static void |
copyStream(java.io.InputStream in,
java.io.OutputStream out,
boolean close)
Copies the content of the InputStream into the
OutputStream
|
static void |
copyStream(java.io.InputStream in,
java.io.OutputStream out,
long bytesToCopy) |
static java.io.OutputStream |
deflate(java.io.OutputStream out)
Deflate the bytes in this stream.
|
static boolean |
deleteTree(java.io.File file)
Recursively deletes directories and files.
|
static byte[] |
getBytes(java.io.InputStream in) |
static byte[] |
getBytes(java.net.URL url)
Reads the data from the URL and returns the bytes read.
|
static java.util.Date |
getLastModified(java.net.URL url)
Gets the last modified timestamp from the URL connection.
|
static java.io.InputStream |
inflate(java.io.InputStream in)
Inflate the bytes in this stream if it is deflated.
|
static boolean |
isGZipped(java.io.PushbackInputStream in)
Returns true if the given input stream is gzipped.
|
static boolean |
isZipped(java.io.PushbackInputStream in)
Deprecated.
|
static java.io.File |
newTempDir()
Creates a temporary directory in the TVC temp folder.
|
static java.lang.String |
read(java.net.URL u)
Reads the data from the URL and returns it as a string.
|
static boolean |
startsWith(java.io.PushbackInputStream in,
byte[] header)
Checks if the first bytes in the inputstream equals the supplied bytes.
|
public static void copyStream(java.io.InputStream in,
java.io.OutputStream out)
throws java.io.IOException
Calling this method is the same as performing:
IOUtils.copyStream(in, out, false);
java.io.IOException - upon I/O errorspublic static void copyStream(java.io.InputStream in,
java.io.OutputStream out,
boolean close)
throws java.io.IOException
in - The inputstream to read data fromout - The outputstream to write toclose - If true, the input stream and output stream is closed.java.io.IOException - upon I/O errorspublic static void copyStream(java.io.InputStream in,
java.io.OutputStream out,
long bytesToCopy)
throws java.io.IOException
java.io.IOExceptionpublic static void copy(java.io.Reader reader,
java.io.Writer writer)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] getBytes(java.io.InputStream in)
throws java.io.IOException
java.io.IOExceptionpublic static java.io.File newTempDir()
throws java.io.IOException
java.io.IOException - If unable to create the directory.public static boolean deleteTree(java.io.File file)
file - The file or directory to delete.public static void copyFile(java.io.File src,
java.io.File dest)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] getBytes(java.net.URL url)
url - The URL to read from.public static java.util.Date getLastModified(java.net.URL url)
url - The URLpublic static java.lang.String read(java.net.URL u)
u - The URL to read from.public static boolean startsWith(java.io.PushbackInputStream in,
byte[] header)
throws java.io.IOException
in - The inputstream.header - The header bytes. If the first bytes equals the bytes in
the header this method returns true. Note that the
PushbackInputStream must have a pushback buffer big enough
for the number of bytes in the header.java.io.IOException - If unable to read/unread.@Deprecated
public static boolean isZipped(java.io.PushbackInputStream in)
throws java.io.IOException
in - The inputstream, needs a pushback buffer of size 4 or more.java.io.IOException - If unable to read/unreadZipUtils.isZipped(PushbackInputStream)public static boolean isGZipped(java.io.PushbackInputStream in)
throws java.io.IOException
in - The inputstream, needs a pushback buffer of size 2 or more.java.io.IOException - If unable to read/unread.public static java.io.InputStream inflate(java.io.InputStream in)
throws java.io.IOException
InputStream in a GZIPInputStream.in - An InputStream.InputStream that will inflate the bytes in the
supplied InputStream, if it is deflated.java.io.IOException - If unable to read from the InputStream.public static java.io.OutputStream deflate(java.io.OutputStream out)
throws java.io.IOException
GZIPOutputStream.out - An OutputStream.GZIPOutputStream.java.io.IOException - If unable to create a GZIPOutputStream.public static void closeQuietly(java.io.InputStream in)
IOUtils.closeQuietly(InputStream)in - public static void closeQuietly(java.io.Reader reader)
IOUtils.closeQuietly(Reader)reader - The reader.public static void closeQuietly(java.io.OutputStream out)
IOUtils.closeQuietly(OutputStream)out - The output streampublic static void closeQuietly(java.io.Writer w)
IOUtils.closeQuietly(Writer)w - The writerCopyright ? Technia AB. All Rights Reserved.