org.fcrepo.server.storage.types
Class MIMETypedStream

java.lang.Object
  extended by org.fcrepo.server.storage.types.MIMETypedStream

public class MIMETypedStream
extends Object

Data structure for holding a MIME-typed stream.

Version:
$Id$
Author:
Ross Wayland

Field Summary
 Property[] header
           
 String MIMEType
           
 
Constructor Summary
MIMETypedStream(String MIMEType, InputStream stream, Property[] header)
          Constructs a MIMETypedStream.
MIMETypedStream(String MIMEType, InputStream stream, Property[] header, long size)
          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.
 long getSize()
           
 InputStream getStream()
          Retrieves the underlying stream.
 void setStream(InputStream stream)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIMEType

public String MIMEType

header

public Property[] header
Constructor Detail

MIMETypedStream

public MIMETypedStream(String MIMEType,
                       InputStream stream,
                       Property[] header)
Constructs a MIMETypedStream.

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

MIMETypedStream

public MIMETypedStream(String MIMEType,
                       InputStream stream,
                       Property[] header,
                       long size)
Constructs a MIMETypedStream.

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

getStream

public 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(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 Object

getSize

public long getSize()


Copyright © 2012 DuraSpace. All Rights Reserved.