Package org.marketcetera.util.file
Class CopyCharsUtils
- java.lang.Object
-
- org.marketcetera.util.file.CopyCharsUtils
-
public final class CopyCharsUtils extends Object
Utilities for copying textual data, in the default JVM charset. The participating media include files, arrays, readers/writers, or some combinations thereof.- Since:
- 0.6.0
- Version:
- $Id: CopyCharsUtils.java 16154 2012-07-14 16:34:05Z colin $
- Author:
- tlerios@marketcetera.com
-
-
Constructor Summary
Constructors Modifier Constructor Description privateCopyCharsUtils()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopy(char[] data, String name)Copies an in-memory character array into the given location.static longcopy(Reader in, boolean inSkipClose, Writer out, boolean outSkipClose)Copies a character stream from the given source to the given sink.static longcopy(Reader in, boolean skipClose, String out)Copies a character stream from the given source to the given location.static char[]copy(String name)Copies the character stream at the given location into memory, returning a character array.static longcopy(String in, Writer out, boolean skipClose)Copies a character stream from the given location to the given sink.static longcopy(String in, String out)Copies a character stream from one given location to another.
-
-
-
Method Detail
-
copy
public static long copy(Reader in, boolean inSkipClose, Writer out, boolean outSkipClose) throws I18NException
Copies a character stream from the given source to the given sink.- Parameters:
in- The character source, as interpreted byReaderWrapper(Reader,boolean).inSkipClose- True if the source reader should not be closed.out- The character sink, as interpreted byWriterWrapper(Writer,boolean).outSkipClose- True if the sink writer should not be closed.- Returns:
- The number of characters 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 character stream from one given location to another.- Parameters:
in- The name of the character source, as interpreted byReaderWrapper(String).out- The name of the character sink, as interpreted byWriterWrapper(String).- Returns:
- The number of characters copied.
- Throws:
I18NException- Thrown if there is a data read/write error.
-
copy
public static long copy(Reader in, boolean skipClose, String out) throws I18NException
Copies a character stream from the given source to the given location.- Parameters:
in- The character source, as interpreted byReaderWrapper(Reader,boolean).skipClose- True if the source reader should not be closed.out- The name of the character sink, as interpreted byWriterWrapper(String).- Returns:
- The number of characters copied.
- Throws:
I18NException- Thrown if there is a data read/write error.
-
copy
public static long copy(String in, Writer out, boolean skipClose) throws I18NException
Copies a character stream from the given location to the given sink.- Parameters:
in- The name of the character source, as interpreted byReaderWrapper(String).out- The character sink, as interpreted byWriterWrapper(Writer,boolean).skipClose- True if the sink writer should not be closed.- Returns:
- The number of characters copied.
- Throws:
I18NException- Thrown if there is a data read/write error.
-
copy
public static char[] copy(String name) throws I18NException
Copies the character stream at the given location into memory, returning a character array.- Parameters:
name- The name of the character source, as interpreted byReaderWrapper(String).- Returns:
- The array.
- Throws:
I18NException- Thrown if there is a data read/write error.
-
copy
public static void copy(char[] data, String name) throws I18NExceptionCopies an in-memory character array into the given location.- Parameters:
data- The array.name- The name of the character sink, as interpreted byWriterWrapper(String).- Throws:
I18NException- Thrown if there is a data read/write error.
-
-