au.com.lastweekend.cgi
Class CGIResponseStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by au.com.lastweekend.cgi.CGIResponseStream
All Implemented Interfaces:
java.io.Closeable

public class CGIResponseStream
extends java.io.FilterInputStream

This is a very stripped back version of the LineInput class from Jetty 5 by Greg Wilkins.

It reads an input stream either line by line as UTF-8 (possibly should be ASCII?) for headers or byte by byte.

Version:
$Id: CGIResponseStream.java 100 2008-02-19 10:37:27Z lwoggardner $
Author:
Grant Gardner grant@lastweekend.com.au

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
CGIResponseStream(java.io.InputStream in)
          Constructor.
 
Method Summary
 int available()
           
 void destroy()
           
 java.io.InputStream getInputStream()
           
 void mark(int limit)
           
 boolean markSupported()
           
 void pipe(java.io.OutputStream out)
          Dump remaining input to output, utilising our buffer...
 int read()
           
 int read(byte[] b, int off, int len)
           
 java.lang.String readLine()
          Read a line ended by CR, LF or CRLF.
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.io.FilterInputStream
close, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CGIResponseStream

public CGIResponseStream(java.io.InputStream in)
Constructor.

Parameters:
in - The underlying input stream.
Method Detail

getInputStream

public java.io.InputStream getInputStream()

readLine

public java.lang.String readLine()
                          throws java.io.IOException
Read a line ended by CR, LF or CRLF. The default or supplied encoding is used to convert bytes to characters.

Returns:
The line as a String or null for EOF.
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.FilterInputStream
Throws:
java.io.IOException

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.FilterInputStream
Throws:
java.io.IOException

mark

public void mark(int limit)
          throws java.lang.IllegalArgumentException
Overrides:
mark in class java.io.FilterInputStream
Throws:
java.lang.IllegalArgumentException

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.FilterInputStream
Throws:
java.io.IOException

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.FilterInputStream

destroy

public void destroy()

pipe

public void pipe(java.io.OutputStream out)
          throws java.io.IOException
Dump remaining input to output, utilising our buffer...

Parameters:
out -
Throws:
java.io.IOException


Copyright © 2008. All Rights Reserved.