com.groovemanager.sampled.nondestructive
Class ConcatInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.groovemanager.sampled.nondestructive.ConcatInputStream
All Implemented Interfaces:
java.io.Closeable

public class ConcatInputStream
extends java.io.InputStream

This class represents an InputStreams that reads its data from different streams in a row, but acts like if it was one stream.

Author:
Manu Robledo

Field Summary
private  int index
          Index of the currently used stream
private  java.io.InputStream[] sources
          The source streams
 
Constructor Summary
ConcatInputStream(java.io.InputStream[] sources)
          Create a new ConcatInputStream out of the given Streams
 
Method Summary
 int available()
           
 void close()
           
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] arg0)
           
 int read(byte[] arg0, int arg1, int arg2)
           
 void reset()
           
 long skip(long n)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

private int index
Index of the currently used stream


sources

private java.io.InputStream[] sources
The source streams

Constructor Detail

ConcatInputStream

public ConcatInputStream(java.io.InputStream[] sources)
Create a new ConcatInputStream out of the given Streams

Parameters:
sources - The source streams to concatenate
Method Detail

available

public int available()
              throws java.io.IOException
Overrides:
available in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.available()

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.close()

mark

public void mark(int readlimit)
Overrides:
mark in class java.io.InputStream
See Also:
InputStream.mark(int)

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.InputStream
See Also:
InputStream.markSupported()

read

public int read()
         throws java.io.IOException
Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read()

read

public int read(byte[] arg0)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read(byte[])

read

public int read(byte[] arg0,
                int arg1,
                int arg2)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read(byte[], int, int)

reset

public void reset()
           throws java.io.IOException
Overrides:
reset in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.reset()

skip

public long skip(long n)
          throws java.io.IOException
Overrides:
skip in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.skip(long)