fedora.server.storage.types
Class MIMETypedStream

java.lang.Object
  extended by fedora.server.storage.types.MIMETypedStream

public class MIMETypedStream
extends java.lang.Object

Title: MIMETypedStream.java

Description: Data structure for holding a MIME-typed stream.

Version:
$Id: MIMETypedStream.java 7652 2008-08-05 13:53:52Z bbranan $
Author:
rlw@virginia.edu

Field Summary
 Property[] header
           
 java.lang.String MIMEType
           
 
Constructor Summary
MIMETypedStream(java.lang.String MIMEType, java.io.InputStream stream, Property[] header)
          Constructs a MIMETypedStream.
 
Method Summary
 void close()
          Closes the underlying stream if it's not already closed.
 void finalize()
          Ensures the underlying stream is closed at garbage-collection time if the stream has not been retrieved.
 java.io.InputStream getStream()
          Retrieves the underlying stream.
 void setStream(java.io.InputStream stream)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIMEType

public java.lang.String MIMEType

header

public Property[] header
Constructor Detail

MIMETypedStream

public MIMETypedStream(java.lang.String MIMEType,
                       java.io.InputStream stream,
                       Property[] header)

Constructs a MIMETypedStream.

Parameters:
MIMEType - The MIME type of the byte stream.
stream - The byte stream.
Method Detail

getStream

public java.io.InputStream getStream()
Retrieves the underlying stream. Caller is responsible to close the stream, either by calling MIMETypedStream.close() or by calling close() on the stream.

Returns:
The byte stream

setStream

public void setStream(java.io.InputStream stream)

close

public void close()
Closes the underlying stream if it's not already closed. In the event of an error, a warning will be logged.


finalize

public void finalize()
Ensures the underlying stream is closed at garbage-collection time if the stream has not been retrieved. If getStream() has been called the caller is responsible to close the stream.

Overrides:
finalize in class java.lang.Object