org.apache.wicket.util.resource
Class AbstractResourceStreamWriter

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

public abstract class AbstractResourceStreamWriter
extends 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.
 String getContentType()
           
 InputStream getInputStream()
          this method should not be used as it is not required for resource writers
 Locale getLocale()
           
 String getStyle()
           
 String getVariation()
           
 Time lastModifiedTime()
          Just returns now.
 Bytes length()
          Default implementation to return -1.
 void setLocale(Locale locale)
           
 void setStyle(String style)
           
 void setVariation(String variation)
           
 
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
 

Constructor Detail

AbstractResourceStreamWriter

public AbstractResourceStreamWriter()
Method Detail

length

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

Specified by:
length in interface IResourceStream

getLocale

public Locale getLocale()
Specified by:
getLocale in interface IResourceStream

setLocale

public void setLocale(Locale locale)
Specified by:
setLocale in interface IResourceStream

lastModifiedTime

public Time lastModifiedTime()
Just returns now.

Specified by:
lastModifiedTime in interface IModifiable

getInputStream

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

Specified by:
getInputStream in interface IResourceStream
Throws:
ResourceStreamNotFoundException

close

public final void close()
                 throws 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 Closeable
Specified by:
close in interface IResourceStream
Throws:
IOException

getContentType

public String getContentType()
Specified by:
getContentType in interface IResourceStream

getStyle

public String getStyle()
Specified by:
getStyle in interface IResourceStream

setStyle

public void setStyle(String style)
Specified by:
setStyle in interface IResourceStream

getVariation

public String getVariation()
Specified by:
getVariation in interface IResourceStream

setVariation

public void setVariation(String variation)
Specified by:
setVariation in interface IResourceStream


Copyright © 2006–2016 Apache Software Foundation. All rights reserved.