org.apache.wicket.util.resource
Class AbstractStringResourceStream

java.lang.Object
  extended by org.apache.wicket.util.resource.AbstractResourceStream
      extended by org.apache.wicket.util.resource.AbstractStringResourceStream
All Implemented Interfaces:
Closeable, Serializable, IClusterable, IResourceStream, IStringResourceStream, IModifiable
Direct Known Subclasses:
StringBufferResourceStream, StringResourceStream, TextTemplate

public abstract class AbstractStringResourceStream
extends AbstractResourceStream

Base class for string resources.

Author:
Jonathan Locke
See Also:
Serialized Form

Field Summary
static String DEFAULT_CONTENT_TYPE
          The content-type applied in case the resource stream's default constructor is used
 
Constructor Summary
AbstractStringResourceStream()
          Constructor.
AbstractStringResourceStream(String contentType)
          Constructor.
 
Method Summary
 void close()
          Closes the resource.
 String getContentType()
          Gets the mime type of this resource
 InputStream getInputStream()
          Gets the resource stream.
protected abstract  String getString()
           
 Time lastModifiedTime()
          Gets the last time this modifiable thing changed.
 long length()
          Gets the size of this resource in bytes TODO 1.5: rename to lengthInBytes() or let it return some sort of size object
 void setLastModified(Time lastModified)
           
 
Methods inherited from class org.apache.wicket.util.resource.AbstractResourceStream
asString, getCharset, getLocale, setCharset, setLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONTENT_TYPE

public static final String DEFAULT_CONTENT_TYPE
The content-type applied in case the resource stream's default constructor is used

See Also:
Constant Field Values
Constructor Detail

AbstractStringResourceStream

public AbstractStringResourceStream()
Constructor.


AbstractStringResourceStream

public AbstractStringResourceStream(String contentType)
Constructor.

Parameters:
contentType - The mime type of this resource, such as "image/jpeg" or "text/html"
Method Detail

close

public void close()
           throws IOException
Description copied from interface: IResourceStream
Closes the resource. Normally, this includes closing any underlying input stream returned by getInputStream().

Throws:
IOException
See Also:
IResourceStream.close()

getContentType

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

Specified by:
getContentType in interface IResourceStream
Overrides:
getContentType in class AbstractResourceStream
Returns:
The mime type of this resource, such as "image/jpeg" or "text/html". Return null to let ResourceStreamRequestTarget handle the Content-Type automatically
See Also:
IResourceStream.getContentType()

getInputStream

public 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:
Returns the inputStream.
Throws:
ResourceStreamNotFoundException
See Also:
IResourceStream.getInputStream()

lastModifiedTime

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

Specified by:
lastModifiedTime in interface IModifiable
Overrides:
lastModifiedTime in class AbstractResourceStream
Returns:
the last modification Time
See Also:
IModifiable.lastModifiedTime()

setLastModified

public void setLastModified(Time lastModified)
Parameters:
lastModified - The lastModified to set.

getString

protected abstract String getString()
Returns:
The string resource

length

public final long length()
Description copied from interface: IResourceStream
Gets the size of this resource in bytes TODO 1.5: rename to lengthInBytes() or let it return some sort of size object

Specified by:
length in interface IResourceStream
Overrides:
length in class AbstractResourceStream
Returns:
The size of this resource in the number of bytes, or -1 if unknown
See Also:
AbstractResourceStream.length()


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.