Package org.marketcetera.util.file
Class CopyBytesUtils
- java.lang.Object
-
- org.marketcetera.util.file.CopyBytesUtils
-
public final class CopyBytesUtils extends Object
Utilities for copying binary data. The participating media include files, arrays, streams, or some combinations thereof.- Since:
- 0.6.0
- Version:
- $Id: CopyBytesUtils.java 16154 2012-07-14 16:34:05Z colin $
- Author:
- tlerios@marketcetera.com
-
-
Constructor Summary
Constructors Modifier Constructor Description privateCopyBytesUtils()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopy(byte[] data, String name)Copies an in-memory byte array into the given location.static longcopy(InputStream in, boolean inSkipClose, OutputStream out, boolean outSkipClose)Copies a byte stream from the given source to the given sink.static longcopy(InputStream in, boolean skipClose, String out)Copies a byte stream from the given source to the given location.static byte[]copy(String name)Copies a byte stream from the given location into memory, returning a byte array.static longcopy(String in, OutputStream out, boolean skipClose)Copies a byte stream from the given location to the given sink.static longcopy(String in, String out)Copies a byte stream from one given location to another.
-
-
-
Method Detail
-
copy
public static long copy(InputStream in, boolean inSkipClose, OutputStream out, boolean outSkipClose) throws I18NException
Copies a byte stream from the given source to the given sink.- Parameters:
in- The byte source, as interpreted byInputStreamWrapper(InputStream,boolean).inSkipClose- True if the source stream should not be closed.out- The byte sink, as interpreted byOutputStreamWrapper(OutputStream,boolean).outSkipClose- True if the sink stream should not be closed.- Returns:
- The number of bytes copied.
- Throws:
I18NException- Thrown if there is a data read/write error.
-
copy
public static long copy(String in, String out) throws I18NException
Copies a byte stream from one given location to another.- Parameters:
in- The name of the byte source, as interpreted byInputStreamWrapper(String).out- The name of the byte sink, as interpreted byOutputStreamWrapper(String).- Returns:
- The number of bytes copied.
- Throws:
I18NException- Thrown if there is a data read/write error.
-
copy
public static long copy(InputStream in, boolean skipClose, String out) throws I18NException
Copies a byte stream from the given source to the given location.- Parameters:
in- The byte source, as interpreted byInputStreamWrapper(InputStream,boolean).skipClose- True if the source stream should not be closed.out- The name of the byte sink, as interpreted byOutputStreamWrapper(String).- Returns:
- The number of bytes copied.
- Throws:
I18NException- Thrown if there is a data read/write error.
-
copy
public static long copy(String in, OutputStream out, boolean skipClose) throws I18NException
Copies a byte stream from the given location to the given sink.- Parameters:
in- The name of the byte source, as interpreted byInputStreamWrapper(String).out- The byte sink, as interpreted byOutputStreamWrapper(OutputStream,boolean).skipClose- True if the sink stream should not be closed.- Returns:
- The number of bytes copied.
- Throws:
I18NException- Thrown if there is a data read/write error.
-
copy
public static byte[] copy(String name) throws I18NException
Copies a byte stream from the given location into memory, returning a byte array.- Parameters:
name- The name of the byte source, as interpreted byInputStreamWrapper(String).- Returns:
- The array.
- Throws:
I18NException- Thrown if there is a data read/write error.
-
copy
public static void copy(byte[] data, String name) throws I18NExceptionCopies an in-memory byte array into the given location.- Parameters:
data- The array.name- The name of the byte sink, as interpreted byOutputStreamWrapper(String).- Throws:
I18NException- Thrown if there is a data read/write error.
-
-