com.croftsoft.core.io
Class StreamLib

java.lang.Object
  extended by com.croftsoft.core.io.StreamLib

public final class StreamLib
extends Object

A library of static methods for the manipulation of input and output streams.

Since:
1999-08-15
Version:
2000-04-30
Author:
David W. Croft

Method Summary
static void main(String[] args)
           
static boolean replaceBytes(InputStream in, OutputStream out, byte[] oldBytes, byte[] newBytes)
          Replaces bytes in a stream as it is being copied from the InputStream to the OutputStream.
static String toString(InputStream inputStream)
          Converts the bytes of the InputStream to a String.
static String toString(InputStream inputStream, String encoding)
          Converts the bytes of the InputStream to a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(String[] args)

replaceBytes

public static boolean replaceBytes(InputStream in,
                                   OutputStream out,
                                   byte[] oldBytes,
                                   byte[] newBytes)
                            throws IOException
Replaces bytes in a stream as it is being copied from the InputStream to the OutputStream.

Does not automatically close the streams after completion. Maintains an internal buffer with the same size as oldBytes.

Returns:
Returns true if bytes were replaced.
Throws:
IOException

toString

public static String toString(InputStream inputStream,
                              String encoding)
                       throws IOException,
                              UnsupportedEncodingException
Converts the bytes of the InputStream to a String.

Does not automatically close the stream after completion.

Throws:
IOException
UnsupportedEncodingException

toString

public static String toString(InputStream inputStream)
                       throws IOException
Converts the bytes of the InputStream to a String.

Does not automatically close the stream after completion.

Throws:
IOException

CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)