|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.util.media.RepeatableMedia
public class RepeatableMedia
RepeatableMedia
adds functionality to another media,
the ability to read repeatedly.
Unlike other media, RepeatableMedia
uses
RepeatableInputStream
, if binary, or RepeatableReader
to make getStreamData()
and getReaderData()
to
be able to re-open when InputStream.close()
or Reader.close()
is called.
In other words, the buffered input stream of the give media
is never closed until it is GC-ed.
Method Summary | |
---|---|
byte[] |
getByteData()
Returns the raw data in byte array. |
java.lang.String |
getContentType()
Returns the content type, e.g., "image/jpeg", or null if not available. |
java.lang.String |
getFormat()
Returns the format name, e.g., "jpeg", or null if not available. |
static Media |
getInstance(Media media)
Returns a repeatable media with a repeatable input stream or reader, or null if the given media is null. |
java.lang.String |
getName()
Returns the name (usually filename) of this media, or null if not available. |
java.io.Reader |
getReaderData()
Returns the raw data in Reader. |
java.io.InputStream |
getStreamData()
Returs the repeatable input stream, if the original input stream is not null. |
java.lang.String |
getStringData()
Returns the raw data in string. |
boolean |
inMemory()
Returns whether the data is cached in memory (in form of byte[] or String). |
boolean |
isBinary()
Returns whether the format of tis content is binary or text-based. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Media getInstance(Media media)
public java.io.Reader getReaderData()
Media
Note: it wraps Media.getStringData()
with StringReader,
if it is in memory (Media.inMemory()
returns true).
getReaderData
in interface Media
Media.getReaderData()
public java.io.InputStream getStreamData()
getStreamData
in interface Media
Media.getStreamData()
,
RepeatableInputStream.getInstance(InputStream)
public byte[] getByteData()
Media
It might not be a copy, so don't modify it directly unless you know what you are doing.
If the data is not cached in memory (Media.inMemory()
return false),
the data will be read from Media.getStreamData()
. Furthermore, it
also implies you can not invoke this method again.
getByteData
in interface Media
Media.getByteData()
public java.lang.String getContentType()
Media
getContentType
in interface Media
Media.getContentType()
public java.lang.String getFormat()
Media
getFormat
in interface Media
Media.getFormat()
public java.lang.String getName()
Media
getName
in interface Media
Media.getName()
public java.lang.String getStringData()
Media
If the data is not cached in memory (Media.inMemory()
return false),
the data will be read from Media.getReaderData()
. Furthermore, it
also implies you can not invoke this method again.
getStringData
in interface Media
Media.getStringData()
public boolean inMemory()
Media
inMemory
in interface Media
Media.inMemory()
public boolean isBinary()
Media
Media.getByteData()
or Media.getStreamData()
to retrieve its content.
If false, use Media.getStringData()
or Media.getReaderData()
to retrieve its content.
isBinary
in interface Media
Media.isBinary()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |