org.apache.synapse.transport.passthru
Class Pipe

java.lang.Object
  extended by org.apache.synapse.transport.passthru.Pipe

public class Pipe
extends Object

This is a buffer shared by both producers and consumers.


Constructor Summary
Pipe(ByteBuffer buffer, String name, BaseConfiguration baseConfig)
           
Pipe(org.apache.http.nio.IOControl producerIoControl, ByteBuffer buffer, String name, BaseConfiguration baseConfig)
           
 
Method Summary
 void attachConsumer(org.apache.http.nio.IOControl consumerIoControl)
          Set the consumers IOControl
 int consume(org.apache.http.nio.ContentEncoder encoder)
          Consume the data from the buffer.
 void consumerError()
           
 void forceSetSerializationRest()
           
 ByteBuffer getBuffer()
           
 InputStream getInputStream()
          Creates an InputStream object on the underlying ByteBuffer.
 OutputStream getOutputStream()
          Creates a separate ByteBuffer for the output data and returns an OutputStream on top of it.
 boolean hasHttpProducer()
           
 boolean isProducerCompleted()
           
 boolean isSerializationComplete()
           
 int produce(org.apache.http.nio.ContentDecoder decoder)
          Produce data in to the buffer.
 void producerError()
           
 OutputStream resetOutputStream()
          Creates a separate ByteBuffer for the output data and returns an OutputStream on top of it.
 void setRawSerializationComplete(boolean rawSerializationComplete)
           
 void setSerializationComplete(boolean serializationComplete)
           
 void setSerializationCompleteWithoutData(boolean serializationComplete)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pipe

public Pipe(org.apache.http.nio.IOControl producerIoControl,
            ByteBuffer buffer,
            String name,
            BaseConfiguration baseConfig)

Pipe

public Pipe(ByteBuffer buffer,
            String name,
            BaseConfiguration baseConfig)
Method Detail

isProducerCompleted

public boolean isProducerCompleted()

attachConsumer

public void attachConsumer(org.apache.http.nio.IOControl consumerIoControl)
Set the consumers IOControl

Parameters:
consumerIoControl - IOControl of the consumer

consume

public int consume(org.apache.http.nio.ContentEncoder encoder)
            throws IOException
Consume the data from the buffer. Before calling this method attachConsumer method must be called with a valid IOControl.

Parameters:
encoder - encoder used to write the data means there will not be any data written in to this buffer
Returns:
number of bytes written (consumed)
Throws:
IOException - if an error occurred while consuming data

produce

public int produce(org.apache.http.nio.ContentDecoder decoder)
            throws IOException
Produce data in to the buffer.

Parameters:
decoder - decoder to read bytes from the underlying stream
Returns:
bytes read (consumed)
Throws:
IOException - if an error occurs while reading data

toString

public String toString()
Overrides:
toString in class Object

consumerError

public void consumerError()

producerError

public void producerError()

getInputStream

public InputStream getInputStream()
Creates an InputStream object on the underlying ByteBuffer. The returned InputStream can be used to read bytes from the underlying buffer which is being filled by the producer.

Returns:
An InputStream object

getOutputStream

public OutputStream getOutputStream()
Creates a separate ByteBuffer for the output data and returns an OutputStream on top of it.

Returns:
An OutputStream object

resetOutputStream

public OutputStream resetOutputStream()
Creates a separate ByteBuffer for the output data and returns an OutputStream on top of it.

Returns:
An OutputStream object

setSerializationComplete

public void setSerializationComplete(boolean serializationComplete)

setSerializationCompleteWithoutData

public void setSerializationCompleteWithoutData(boolean serializationComplete)

setRawSerializationComplete

public void setRawSerializationComplete(boolean rawSerializationComplete)

forceSetSerializationRest

public void forceSetSerializationRest()

isSerializationComplete

public boolean isSerializationComplete()

getBuffer

public ByteBuffer getBuffer()

hasHttpProducer

public boolean hasHttpProducer()


Copyright © 2005–2015 Apache Software Foundation. All rights reserved.