wicket.util.resource
Class FileResourceStream

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

public 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)
          Constructor.
 
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, getLocale, setCharset, setLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileResourceStream

public FileResourceStream(File file)
Constructor.

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. The same input stream is returned until FileResourceStream.close() is invoked.
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()
Overrides:
toString in class java.lang.Object
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-2007 Wicket developers. All Rights Reserved.