org.jclouds.util
Class InputStreamChain

java.lang.Object
  extended by java.io.InputStream
      extended by org.jclouds.util.InputStreamChain
All Implemented Interfaces:
Closeable

public class InputStreamChain
extends InputStream

InputStream implementation that allows chaining of various streams for seamless sequential reading

Author:
Adrian Cole, Tomas Varaneckas

Constructor Summary
InputStreamChain(InputStream... inputStreams)
           
 
Method Summary
 InputStreamChain addAsInputStream(String value)
          Adds a String to the end of chain
 InputStreamChain addInputStream(InputStream stream)
          Adds input stream to the end of chain
 int available()
           
 void close()
           
 void mark(int i)
           
 boolean markSupported()
           
 int read()
           
 void reset()
           
 long skip(long l)
           
 
Methods inherited from class java.io.InputStream
read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputStreamChain

public InputStreamChain(InputStream... inputStreams)
Method Detail

addInputStream

public InputStreamChain addInputStream(InputStream stream)
Adds input stream to the end of chain

Parameters:
stream - InputStream to add to chain
Returns:
instance of self (for fluent calls)

addAsInputStream

public InputStreamChain addAsInputStream(String value)
Adds a String to the end of chain

Parameters:
value - String to add to the chain
Returns:
instance of self (for fluent calls)

read

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

available

public int available()
              throws IOException
Overrides:
available in class InputStream
Throws:
IOException

close

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

markSupported

public boolean markSupported()
Overrides:
markSupported in class InputStream

mark

public void mark(int i)
Overrides:
mark in class InputStream

reset

public void reset()
           throws IOException
Overrides:
reset in class InputStream
Throws:
IOException

skip

public long skip(long l)
          throws IOException
Overrides:
skip in class InputStream
Throws:
IOException


Copyright © 2009-2012 jclouds. All Rights Reserved.