org.apache.tapestry5.internal.services
Interface StreamableResource

All Known Implementing Classes:
StreamableResourceImpl

public interface StreamableResource

Abstracts around a Resource to allow access to the resource's content either compressed on uncompressed. The advantage is that, for cmpressed streams, the data is only compressed once, rather than for each request.

Since:
5.1.0.0

Method Summary
 String getContentType()
          Returns the content type available from the underlying URLConnection, which may be null.
 long getLastModified()
          Returns the time the underlying file was last modified.
 int getSize(boolean compress)
          Returns the size of the content
 InputStream getStream(boolean compress)
          Returns the raw input stream (wrapped in a BufferedInputStream, or the compressed bytestream.
 

Method Detail

getContentType

String getContentType()
                      throws IOException
Returns the content type available from the underlying URLConnection, which may be null.

Returns:
content type, or null
Throws:
IOException

getSize

int getSize(boolean compress)
            throws IOException
Returns the size of the content

Parameters:
compress - if true, return size of compressed content
Returns:
size
Throws:
IOException

getStream

InputStream getStream(boolean compress)
                      throws IOException
Returns the raw input stream (wrapped in a BufferedInputStream, or the compressed bytestream.

Parameters:
compress - if true, return compressed version
Returns:
stream of raw or compressed bytes
Throws:
IOException

getLastModified

long getLastModified()
                     throws IOException
Returns the time the underlying file was last modified.

Throws:
IOException


Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.