org.apache.qpid.proton.engine.impl.ssl
Class BytePipeline

java.lang.Object
  extended by org.apache.qpid.proton.engine.impl.ssl.BytePipeline

public class BytePipeline
extends Object

Thinly wraps a ByteBuffer to make it easy to be used for the following sequence of operations:

  1. Append some more bytes (of any size) to me using appendAndClear(byte[], int, int)
  2. Read some of my bytes
  3. Set my contents using set(ByteBuffer, int)

See Also:
SimpleSslTransportWrapper

Constructor Summary
BytePipeline()
           
 
Method Summary
 ByteBuffer appendAndClear(byte[] newBytes, int offset, int numberOfNewBytesToAppend)
          Append the new bytes to my existing not-yet-consumed ones.
 int getSize()
          Get the number of bytes not yet consumed
 void set(ByteBuffer newBytes, int offset)
          Stores the portion of newBytes implied by the offset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BytePipeline

public BytePipeline()
Method Detail

appendAndClear

public ByteBuffer appendAndClear(byte[] newBytes,
                                 int offset,
                                 int numberOfNewBytesToAppend)
Append the new bytes to my existing not-yet-consumed ones. newBytes is copied, to guard against the caller subsequently modifying its contents.

Returns:
a read-only ByteBuffer containing the existiduplicateng contents plus the portion of newBytes implied by offset and size. The returned object is intentionally not a copy; this allows clients to "consume" bytes by calling the the get(..) methods on it.

set

public void set(ByteBuffer newBytes,
                int offset)
Stores the portion of newBytes implied by the offset. Does not take a copy of the provided buffer's content because we assume no further changes will be made to it.


getSize

public int getSize()
Get the number of bytes not yet consumed



Copyright © 2013 The Apache Software Foundation. All Rights Reserved.