org.apache.wicket.util.resource
Class AbstractResourceStreamWriter

java.lang.Object
  extended by org.apache.wicket.util.resource.AbstractResourceStreamWriter
All Implemented Interfaces:
java.io.Serializable, IClusterable, IResourceStream, IResourceStreamWriter, IModifiable

public abstract class AbstractResourceStreamWriter
extends java.lang.Object
implements IResourceStreamWriter

Base implementation of an IResourceStreamWriter so that you only have to override the IResourceStreamWriter.write(java.io.OutputStream) Don't forget to overwrite the IResourceStream.length() method if you do know the total length that will be generated.

See Also:
IResourceStreamWriter, Serialized Form

Constructor Summary
AbstractResourceStreamWriter()
           
 
Method Summary
 void close()
          this method should not be used as it is not required for resource writers

resource write generate content directly, not using an input stream, so there's nothing to close later.

 java.io.InputStream getInputStream()
          this method should not be used as it is not required for resource writers
 java.util.Locale getLocale()
           
 Time lastModifiedTime()
          Just returns now.
 long length()
          Default implementation to return -1.
 void setLocale(java.util.Locale locale)
          This method shouldn't be used for the outside, It is used by the Loaders to set the resolved locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.wicket.util.resource.IResourceStreamWriter
write
 
Methods inherited from interface org.apache.wicket.util.resource.IResourceStream
getContentType
 

Constructor Detail

AbstractResourceStreamWriter

public AbstractResourceStreamWriter()
Method Detail

length

public long length()
Default implementation to return -1. Do override this if you know the length up front.

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

getLocale

public java.util.Locale getLocale()
Specified by:
getLocale in interface IResourceStream
Returns:
The Locale where this stream did resolve to
See Also:
IResourceStream.getLocale()

setLocale

public void setLocale(java.util.Locale locale)
Description copied from interface: IResourceStream
This method shouldn't be used for the outside, It is used by the Loaders to set the resolved locale.

Specified by:
setLocale in interface IResourceStream
Parameters:
locale - The Locale where this stream did resolve to.
See Also:
IResourceStream.setLocale(java.util.Locale)

lastModifiedTime

public Time lastModifiedTime()
Just returns now.

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

getInputStream

public final java.io.InputStream getInputStream()
                                         throws ResourceStreamNotFoundException
this method should not be used as it is not required for resource writers

Specified by:
getInputStream in interface IResourceStream
Returns:
input stream
Throws:
ResourceStreamNotFoundException
See Also:
IResourceStream.close()

close

public final void close()
                 throws java.io.IOException
this method should not be used as it is not required for resource writers

resource write generate content directly, not using an input stream, so there's nothing to close later.

Specified by:
close in interface IResourceStream
Throws:
java.io.IOException


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