Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## things.common.tools
Class StreamTools

    java.lang.Object
      things.common.tools.StreamTools

    public class StreamTools

extends java.lang.Object

Tools for stream manipulation.

Version:
  1.0

  Version History

      EPG - Initial - 14 MAR 05

Author:
  Erich P. Gatejen

Constructor Summary
`StreamTools()`

Method Summary
`static java.lang.String` | `loadStream2String(java.io.InputStream is)` Read a stream into a String.
`static boolean` | `merge(java.io.Reader input, java.io.Writer output, ThingsPropertyViewReader props)` Merge a reader with properties to writer.
`static boolean` | `merge(java.io.Reader input, java.io.Writer output, ThingsPropertyViewReader props, StringPoster log)` Merge a reader with properties to writer.
`static void` | `string2File(java.lang.String theString, java.io.File destination)` Write a string to file using default encoding.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### StreamTools

    public StreamTools()

Method Detail

### merge

    public static boolean merge(java.io.Reader input,
                                java.io.Writer output,
                                ThingsPropertyViewReader props,
                                StringPoster log)

  Merge a reader with properties to writer. It will not buffer either, so pass buffered implementations, if that matters. It will only work properly with 16-bit UTF-16 (which should cover typical Unicode 4.0).
  You can escape property names with double characters.
  "Test $$ text" = "Test $ text"
  "Test $aa$$a$ is a test" = "Test {value of 'aa$a') is a test" without the paren.

  Exceptions are logged, not thrown.

  Parameters:
    `input` - A Reader source.
    `output` - A Writer destination.
    `props` - Properties that are candidates for substitution.
    `log` - A StringPoster for posting error or information messages.
  Returns:
    true if it completed without error, otherwise false
  See Also:
    `StringPoster`

### merge

    public static boolean merge(java.io.Reader input,
                                java.io.Writer output,
                                ThingsPropertyViewReader props)
                         throws java.lang.Throwable

  Merge a reader with properties to writer. It will not buffer either, so pass buffered implementations, if that matters. It will only work properly with 16-bit UTF-16 (which should cover typical Unicode 4.0).
  You can escape property names with double characters.
  "Test $$ text" = "Test $ text"
  "Test $aa$$a$ is a test" = "Test {value of 'aa$a') is a test" without the paren.

  Any error will throw an exception.

  Parameters:
    `input` - A Reader source.
    `output` - A Writer destination.
    `props` - Properties that are candidates for substitution.
  Returns:
    true if it completed without error, otherwise false
  Throws:
    `java.lang.Throwable`
  See Also:
    `StringPoster`

### loadStream2String

    public static java.lang.String loadStream2String(java.io.InputStream is)
                                              throws java.io.IOException

  Read a stream into a String. This should be used only is absolutely needed.

  Parameters:
    `is` - The stream to load. It should be buffered before calling this,
  Returns:
    String if successful or otherwise null
  Throws:
    `Certain` - IOException, like if the file cannot be found or opened.
    `java.io.IOException`

### string2File

    public static void string2File(java.lang.String theString,
                                   java.io.File destination)
                            throws java.io.IOException

  Write a string to file using default encoding.

  Parameters:
    `theString` - The string
    `destination` - The file destination
  Throws:
    `Certain` - IOException, like if the file cannot be found or opened.
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Things.