com.limegroup.gnutella.util
Class IOUtils

java.lang.Object
  extended bycom.limegroup.gnutella.util.IOUtils

public class IOUtils
extends java.lang.Object

Provides utility I/O methods, used by multiple classes


Constructor Summary
IOUtils()
           
 
Method Summary
static java.lang.String readWord(java.io.InputStream in, int maxSize)
          Returns the first word of specified maximum size up to the first space and returns it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOUtils

public IOUtils()
Method Detail

readWord

public static java.lang.String readWord(java.io.InputStream in,
                                        int maxSize)
                                 throws java.io.IOException
Returns the first word of specified maximum size up to the first space and returns it. This does not read up to the first whitespace character -- it only looks for a single space. This is particularly useful for reading HTTP requests, as the request method, the URI, and the HTTP version must all be separated by a single space. Note that only one extra character is read from the stream in the case of success (the white space character after the word).

Parameters:
in - The input stream from where to read the word
maxSize - The maximum size of the word.
Returns:
the first word (i.e., no whitespace) of specified maximum size
Throws:
java.io.IOException - if the word of specified maxSize couldnt be read, either due to stream errors, or timeouts