org.ikasan.framework.util
Class AggregatedContentInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.ikasan.framework.util.AggregatedContentInputStream
All Implemented Interfaces:
Closeable

public abstract class AggregatedContentInputStream
extends InputStream

Abstract InputStream implementation supported by blocks of byte arrays Subclasses of this class will incrementally supply an unknown number of content blocks in the form of byte arrays, which will be available seamlessly to the stream hooks exist for injecting additional content: 1) before the first block (header) 2) between each block 3) after each block 4) after the last block (footer)

Author:
Ikasan Development Team

Constructor Summary
AggregatedContentInputStream()
           
 
Method Summary
protected  byte[] getAfterContent()
          Hook method for subclasses to inject content after each block
protected  byte[] getBeforeContent()
          Hook method for subclasses to inject content before each block
protected  byte[] getFooter()
          Hook method for subclasses to inject footer content after last block
protected  byte[] getHeader()
          Hook method for subclasses to header content before first block
protected abstract  byte[] getNextContent()
          Returns the next chunk of content
protected abstract  boolean hasMoreContent()
          Returns true if there is more content to consume
 int read()
           
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregatedContentInputStream

public AggregatedContentInputStream()
Method Detail

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

getFooter

protected byte[] getFooter()
Hook method for subclasses to inject footer content after last block

Returns:
footer

getAfterContent

protected byte[] getAfterContent()
Hook method for subclasses to inject content after each block

Returns:
after content

getBeforeContent

protected byte[] getBeforeContent()
Hook method for subclasses to inject content before each block

Returns:
before content

getHeader

protected byte[] getHeader()
Hook method for subclasses to header content before first block

Returns:
header

getNextContent

protected abstract byte[] getNextContent()
Returns the next chunk of content

Returns:
next bit of content

hasMoreContent

protected abstract boolean hasMoreContent()
Returns true if there is more content to consume

Returns:
true if there is more content to consume


Copyright © 2007-2012 Ikasan. All Rights Reserved.