au.com.lastweekend.cgi
Class FastCGIInputStream

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

public abstract class FastCGIInputStream
extends java.io.FilterInputStream

Encapsulates the FastCGI socket protocol which contains fixed length data packets. In each role, WebServer, Responder. Note that we do not support multiplexed requests on the underlying stream. Streams and sockets are good at that already, we don't need to re-invent the wheel

Version:
$Id$
Author:
Grant Gardner grant@lastweekend.com.au

Field Summary
protected static org.slf4j.Logger LOG
           
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
FastCGIInputStream(int requestId, java.io.InputStream in)
           
 
Method Summary
protected  boolean atEndOfRequest()
           
 int available()
           
protected  void getMoreStreamData()
           
protected abstract  boolean isStream(int type)
           
protected  void notifyEndOfStream(int type)
           
protected abstract  void processData(int type, byte[] contentBuffer, int contentLength)
           
 int read()
           
 int read(byte[] b, int off, int len)
           
protected  void readData()
           
protected static int readFixedLengthData(byte[] buffer, int len, java.io.InputStream inputStream)
           
protected static int readLong(byte[] data, int offset)
           
protected static int readShort(byte[] data, int offset)
           
protected  void setRequestComplete()
           
 
Methods inherited from class java.io.FilterInputStream
close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.slf4j.Logger LOG
Constructor Detail

FastCGIInputStream

public FastCGIInputStream(int requestId,
                          java.io.InputStream in)
Method Detail

readShort

protected static int readShort(byte[] data,
                               int offset)

readLong

protected static int readLong(byte[] data,
                              int offset)

read

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

readData

protected void readData()
                 throws java.io.IOException
Throws:
java.io.IOException

getMoreStreamData

protected final void getMoreStreamData()
                                throws java.io.IOException
Throws:
java.io.IOException

notifyEndOfStream

protected void notifyEndOfStream(int type)

isStream

protected abstract boolean isStream(int type)

processData

protected abstract void processData(int type,
                                    byte[] contentBuffer,
                                    int contentLength)
                             throws java.io.IOException
Throws:
java.io.IOException

setRequestComplete

protected final void setRequestComplete()

atEndOfRequest

protected boolean atEndOfRequest()

available

public int available()
              throws java.io.IOException
Overrides:
available 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

readFixedLengthData

protected static int readFixedLengthData(byte[] buffer,
                                         int len,
                                         java.io.InputStream inputStream)
                                  throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2008. All Rights Reserved.