public final class IOUtilities extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
IOUtilities.TransferCallback |
Modifier and Type | Method and Description |
---|---|
static void |
close(Closeable c) |
static void |
close(XMLStreamReader reader) |
static void |
close(XMLStreamWriter writer) |
static byte[] |
compressBytes(byte[] bytes) |
static void |
compressBytes(ByteArrayOutputStream original,
ByteArrayOutputStream compressed) |
static void |
flush(Flushable f) |
static void |
flush(XMLStreamWriter writer) |
static InputStream |
getInputStream(URLConnection c) |
static byte[] |
inputStreamToBytes(InputStream in)
Convert InputStream contents to a byte[].
|
static void |
transfer(File file,
OutputStream out) |
static void |
transfer(File f,
URLConnection c,
IOUtilities.TransferCallback cb) |
static void |
transfer(InputStream in,
byte[] bytes)
Use this when you expect a byte[] length of bytes to be read from the InputStream
|
static void |
transfer(InputStream s,
File f,
IOUtilities.TransferCallback cb) |
static void |
transfer(InputStream in,
OutputStream out)
Transfers bytes from an input stream to an output stream.
|
static void |
transfer(InputStream in,
OutputStream out,
IOUtilities.TransferCallback cb)
Transfers bytes from an input stream to an output stream.
|
static void |
transfer(URLConnection c,
byte[] bytes)
Transfers a byte[] to the output stream of a URLConnection
|
static void |
transfer(URLConnection c,
File f,
IOUtilities.TransferCallback cb) |
static byte[] |
uncompressBytes(byte[] bytes) |
public static InputStream getInputStream(URLConnection c) throws IOException
IOException
public static void transfer(File f, URLConnection c, IOUtilities.TransferCallback cb) throws Exception
Exception
public static void transfer(URLConnection c, File f, IOUtilities.TransferCallback cb) throws Exception
Exception
public static void transfer(InputStream s, File f, IOUtilities.TransferCallback cb) throws Exception
Exception
public static void transfer(InputStream in, OutputStream out, IOUtilities.TransferCallback cb) throws IOException
IOException
public static void transfer(InputStream in, byte[] bytes) throws IOException
IOException
public static void transfer(InputStream in, OutputStream out) throws IOException
IOException
public static void transfer(File file, OutputStream out) throws IOException
IOException
public static void close(XMLStreamReader reader)
public static void close(XMLStreamWriter writer)
public static void close(Closeable c)
public static void flush(Flushable f)
public static void flush(XMLStreamWriter writer)
public static byte[] inputStreamToBytes(InputStream in)
public static void transfer(URLConnection c, byte[] bytes) throws IOException
c
- Connection to transfer outputbytes
- the bytes to sendIOException
public static void compressBytes(ByteArrayOutputStream original, ByteArrayOutputStream compressed) throws IOException
IOException
public static byte[] compressBytes(byte[] bytes)
public static byte[] uncompressBytes(byte[] bytes)
Copyright © 2016. All rights reserved.