edu.ucsb.nceas.morpho.util
Class IOUtil

java.lang.Object
  |
  +--edu.ucsb.nceas.morpho.util.IOUtil

public class IOUtil
extends java.lang.Object

General static utilities for IO operations


Method Summary
static java.lang.StringBuffer getAsStringBuffer(java.io.Reader reader, boolean closeWhenFinished)
          reads character data from the Reader provided, using a buffered read.
static java.lang.String getStringArrayAsString(java.lang.String[] stringArray)
          Given an array of String objects, returns the array elements as a single string, formatted as a "list" for printing to command line or logging
static void writeToWriter(java.lang.StringBuffer buffer, java.io.Writer writer, boolean closeWhenFinished)
          reads character data from the StringBuffer provided, and writes it to the Writer provided, using a buffered write.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAsStringBuffer

public static java.lang.StringBuffer getAsStringBuffer(java.io.Reader reader,
                                                       boolean closeWhenFinished)
                                                throws java.io.IOException
reads character data from the Reader provided, using a buffered read. Returns data as a StringBufer
Parameters:
reader - Reader object to be read
closeWhenFinished - boolean value to indicate whether Reader should be closed when reading finished
Returns:
StringBuffer containing characters read from the Reader
Throws:
java.io.IOException - if there are problems accessing or using the Reader.

writeToWriter

public static void writeToWriter(java.lang.StringBuffer buffer,
                                 java.io.Writer writer,
                                 boolean closeWhenFinished)
                          throws java.io.IOException
reads character data from the StringBuffer provided, and writes it to the Writer provided, using a buffered write.
Parameters:
buffer - StringBuffer whose contents are to be written to the Writer
writer - java.io.Writer where contents of StringBuffer are to be written
closeWhenFinished - boolean value to indicate whether Reader should be closed when reading finished
Returns:
StringBuffer containing characters read from the Reader
Throws:
java.io.IOException - if there are problems accessing or using the Writer.

getStringArrayAsString

public static java.lang.String getStringArrayAsString(java.lang.String[] stringArray)
Given an array of String objects, returns the array elements as a single string, formatted as a "list" for printing to command line or logging
Parameters:
stringArray - an array of String objects
Returns:
the array elements in a single string, formatted as a "list" for printing to command line or logging


Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.