wicket.util.resource
Class FileResourceStream

java.lang.Object
  extended bywicket.util.resource.AbstractResourceStream
      extended bywicket.util.resource.FileResourceStream
All Implemented Interfaces:
IModifiable, IResourceStream, IStringResourceStream, java.io.Serializable

public final class FileResourceStream
extends AbstractResourceStream

A FileResourceStream is an IResource implementation for files.

Author:
Jonathan Locke
See Also:
IResourceStream, IModifiable, Serialized Form

Constructor Summary
FileResourceStream(File file)
          Private constructor to force use of static factory methods.
 
Method Summary
 void close()
          Closes this resource.
 java.lang.String getContentType()
          Gets the mime type of this resource
 File getFile()
           
 java.io.InputStream getInputStream()
          Gets the resource stream.
 Time lastModifiedTime()
          Gets the last time this modifiable thing changed.
 long length()
          Gets the size of this resource
 java.lang.String toString()
           
 
Methods inherited from class wicket.util.resource.AbstractResourceStream
asString, getCharset, setCharset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileResourceStream

public FileResourceStream(File file)
Private constructor to force use of static factory methods.

Parameters:
file - File containing resource
Method Detail

close

public void close()
           throws java.io.IOException
Closes this resource.

Throws:
java.io.IOException

getContentType

public java.lang.String getContentType()
Description copied from interface: IResourceStream
Gets the mime type of this resource

Returns:
The content type of this resource, such as "image/jpeg" or "text/html"

getFile

public File getFile()
Returns:
The file this resource resides in, if any.

getInputStream

public java.io.InputStream getInputStream()
                                   throws ResourceStreamNotFoundException
Description copied from interface: IResourceStream
Gets the resource stream. You should not directly close this stream. Instead call the close() method on IResourceStream.

Returns:
A readable input stream for this resource.
Throws:
ResourceStreamNotFoundException
See Also:
IResourceStream.close()

lastModifiedTime

public Time lastModifiedTime()
Description copied from interface: IModifiable
Gets the last time this modifiable thing changed.

Returns:
The last time this resource was modified
See Also:
IModifiable.lastModifiedTime()

toString

public java.lang.String toString()
See Also:
Object.toString()

length

public long length()
Description copied from interface: IResourceStream
Gets the size of this resource

Returns:
The size of this resource in the number of bytes
See Also:
IResourceStream.length()


Copyright © 2004-2005 Wicket developers. All Rights Reserved.