com.echomine.util
Class IOUtil

java.lang.Object
  extended by com.echomine.util.IOUtil

public class IOUtil
extends java.lang.Object

Convenience methods that closes IO Streams


Constructor Summary
IOUtil()
           
 
Method Summary
static void closeSocket(java.net.ServerSocket socket)
           
static void closeSocket(java.net.Socket socket)
           
static void closeSocket(alt.java.net.Socket socket)
           
static void closeStream(java.io.InputStream is)
           
static void closeStream(java.io.OutputStream os)
           
static void closeStream(java.io.Reader is)
           
static void closeStream(java.io.Writer os)
           
static int readToCRLF(java.io.InputStream is, byte[] bytebuf, int offset, int length)
          reads from the stream into the buffer until it read in the entire line or the length is reached.
static int readToLF(java.io.InputStream is, byte[] bytebuf, int offset, int length)
          reads from the stream into the buffer until it read in the entire line or the length is reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOUtil

public IOUtil()
Method Detail

closeStream

public static void closeStream(java.io.InputStream is)

closeStream

public static void closeStream(java.io.OutputStream os)

closeStream

public static void closeStream(java.io.Reader is)

closeStream

public static void closeStream(java.io.Writer os)

closeSocket

public static void closeSocket(java.net.Socket socket)

closeSocket

public static void closeSocket(alt.java.net.Socket socket)

closeSocket

public static void closeSocket(java.net.ServerSocket socket)

readToCRLF

public static int readToCRLF(java.io.InputStream is,
                             byte[] bytebuf,
                             int offset,
                             int length)
                      throws java.io.IOException
reads from the stream into the buffer until it read in the entire line or the length is reached. The CRLF are not included as part of the buffer

Parameters:
is - the InputStream to read the data from
bytebuf - the byte buffer where the data goes to
offset - the offset from which to start writing in the buffer
length - the maximum length to read if CRLF is not reached yet
Throws:
java.io.IOException

readToLF

public static int readToLF(java.io.InputStream is,
                           byte[] bytebuf,
                           int offset,
                           int length)
                    throws java.io.IOException
reads from the stream into the buffer until it read in the entire line or the length is reached. The LF is not included as part of the buffer

Parameters:
is - the InputStream to read the data from
bytebuf - the byte buffer where the data goes to
offset - the offset from which to start writing in the buffer
length - the maximum length to read if CRLF is not reached yet
Throws:
java.io.IOException


Copyright © 2001-2005 Echomine. All Rights Reserved.