com.sun.grizzly.filter
Class ProtocolOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by com.sun.grizzly.filter.ProtocolOutputStream
All Implemented Interfaces:
Closeable, Flushable

public abstract class ProtocolOutputStream
extends OutputStream

A Stream which wraps bytes into an Custom Protocol. See MessageBase.parseHeader(java.nio.ByteBuffer, int, com.sun.grizzly.filter.ReplyMessageFactory) for a dscription of the header layout

Version:
1.0
Author:
John Vieten 23.06.2008

Field Summary
protected  byte[] buf
           
 
Constructor Summary
ProtocolOutputStream(byte messageType, boolean gzip)
           
ProtocolOutputStream(byte messageType, Integer requestId, Integer sessionId, boolean gzip)
           
 
Method Summary
 void close()
           
 void flush()
           
 Integer getRequestId()
           
 void setApplicationLayerError(boolean applicationLayerError)
           
 void setExceptionHandler(IOExceptionHandler handler)
           
 void setInputStream(RemoteInputStream inputStream)
           
 void setMessageType(byte messageType)
           
 void setTrafficListener(BytesTrafficListener trafficListener)
           
 void write(byte[] b, int off, int len)
           
abstract  void write(ByteBuffer b, AsyncWriteCallbackHandler callbackHandler)
           
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buf

protected byte[] buf
Constructor Detail

ProtocolOutputStream

public ProtocolOutputStream(byte messageType,
                            Integer requestId,
                            Integer sessionId,
                            boolean gzip)
Parameters:
asynWritable -
messageType -
requestId -
sessionId -
gzip -

ProtocolOutputStream

public ProtocolOutputStream(byte messageType,
                            boolean gzip)
Parameters:
asynWritable -
messageType -
gzip -
Method Detail

setExceptionHandler

public void setExceptionHandler(IOExceptionHandler handler)

write

public abstract void write(ByteBuffer b,
                           AsyncWriteCallbackHandler callbackHandler)

setApplicationLayerError

public void setApplicationLayerError(boolean applicationLayerError)

setMessageType

public void setMessageType(byte messageType)

setInputStream

public void setInputStream(RemoteInputStream inputStream)

setTrafficListener

public void setTrafficListener(BytesTrafficListener trafficListener)

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Overrides:
write in class OutputStream
Throws:
IOException

getRequestId

public Integer getRequestId()

flush

public void flush()
           throws IOException
Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException


Copyright © 2012 Oracle Corporation. All Rights Reserved.