Spring for Apache Hadoop

org.springframework.data.hadoop.store.support
Class StreamsHolder<T extends java.io.Closeable>

java.lang.Object
  extended by org.springframework.data.hadoop.store.support.StreamsHolder<T>
Type Parameters:
T - a type of a stream
All Implemented Interfaces:
java.io.Closeable

public class StreamsHolder<T extends java.io.Closeable>
extends java.lang.Object
implements java.io.Closeable

Holder object for streams. Mostly concept of a wrapped streams are used with a compressed streams in a hadoop where some information still needs to be accessed from an underlying stream.

Author:
Janne Valkealahti

Constructor Summary
StreamsHolder()
          Instantiates a new streams holder.
StreamsHolder(T stream, T wrappedStream)
          Instantiates a new streams holder.
StreamsHolder(T stream, T wrappedStream, org.apache.hadoop.fs.Path path)
          Instantiates a new streams holder.
 
Method Summary
 void close()
          Close both streams in this holder.
 org.apache.hadoop.fs.Path getPath()
          Gets the path.
 T getStream()
          Gets the stream.
 T getWrappedStream()
          Gets the wrapped stream.
 void setPath(org.apache.hadoop.fs.Path path)
          Sets the path.
 void setStream(T stream)
          Sets the stream.
 void setWrappedStream(T wrappedStream)
          Sets the wrapped stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamsHolder

public StreamsHolder()
Instantiates a new streams holder.


StreamsHolder

public StreamsHolder(T stream,
                     T wrappedStream)
Instantiates a new streams holder.

Parameters:
stream - the stream
wrappedStream - the wrapped stream

StreamsHolder

public StreamsHolder(T stream,
                     T wrappedStream,
                     org.apache.hadoop.fs.Path path)
Instantiates a new streams holder.

Parameters:
stream - the stream
wrappedStream - the wrapped stream
path - the path
Method Detail

close

public void close()
           throws java.io.IOException
Close both streams in this holder. Possible IOException by closing wrapped stream is not thrown.

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException
See Also:
InputStream.close(), OutputStream.close()

getStream

public T getStream()
Gets the stream.

Returns:
the stream

setStream

public void setStream(T stream)
Sets the stream.

Parameters:
stream - the new stream

getWrappedStream

public T getWrappedStream()
Gets the wrapped stream.

Returns:
the wrapped stream

setWrappedStream

public void setWrappedStream(T wrappedStream)
Sets the wrapped stream.

Parameters:
wrappedStream - the new wrapped stream

getPath

public org.apache.hadoop.fs.Path getPath()
Gets the path.

Returns:
the path

setPath

public void setPath(org.apache.hadoop.fs.Path path)
Sets the path.

Parameters:
path - the new path

Spring for Apache Hadoop