org.nakedobjects.metamodel.commons.io
Class LazyInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.nakedobjects.metamodel.commons.io.LazyInputStream
All Implemented Interfaces:
java.io.Closeable

public class LazyInputStream
extends java.io.InputStream

An input stream that reads from an underlying InputStream, deferring the interactions until needed.

This other stream is provided as needed by an LazyInputStream.InputStreamProvider so that the underlying stream is not eagerly loaded.


Nested Class Summary
static interface LazyInputStream.InputStreamProvider
          An interface to be implemented by clients that wish to utilize LazyInputStreams.
 
Constructor Summary
LazyInputStream(LazyInputStream.InputStreamProvider provider)
          Construct a new lazy stream based off the given provider.
 
Method Summary
 int available()
           
 void close()
           
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 void mark(int readlimit)
           
 boolean markSupported()
           
 int read()
           
 int read(byte[] b)
           
 int read(byte[] b, int off, int len)
           
 void reset()
           
 long skip(long n)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LazyInputStream

public LazyInputStream(LazyInputStream.InputStreamProvider provider)
Construct a new lazy stream based off the given provider.

Parameters:
provider - the input stream provider. Must not be null.
Method Detail

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

available

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

mark

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

markSupported

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

read

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

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Overrides:
read in class java.io.InputStream
Throws:
java.io.IOException

read

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

skip

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

reset

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

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.