|
||||||||||
PREV CLASS NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This basic interface is used throughout Enterprise Media Beans to define the most common behavior for media objects. It defines the services common to all kinds of media objects, regardless of them being persistent or transient.
There are basically two major ways to implement this interface. Media
Entity Beans deal with media content modeled as EJB entity beans, i.e. media
that is persistent and mutable. The class MediaBean
(src) models media
content that is local, possibly transient and immutable.
In order to allow a common view on all kinds of media objects, the Media
interface extends Serializable
, regardless of media being
persistent or transient. Having the Media interface extend Serializable
ensures that instances can be transferred over remote boundaries, for
example using facade stateless session beans.
Field Summary | |
static java.lang.String |
MIME_TYPE_UNKNOWN
|
Method Summary | |
byte[] |
getContent()
Returns the complete media content as a byte array. |
MediaFormat (src) |
getFormat()
Queries a suitable media format instance from the MediaFormatRegistry singleton and returns it. |
MediaHeader (src) |
getHeader()
Returns the receiver's header information. |
java.lang.String |
getMimeType()
Returns a mime type for the receiver's content as a string. |
java.lang.String |
getName()
Returns the receiver's non-unique name as a String. |
Media (src) |
getProxy()
Returns a media object that can be used as a proxy for the receiver, e.g. |
long |
getSize()
This operation returns the receiver's content size in number of bytes as a long value. |
int |
readContent(long position,
byte[] buffer)
Similarly to input streams, this method fills the given buffer with content read from the media object. |
int |
readContent(long position,
byte[] buffer,
int offset,
int length)
Similar to input streams, this method fills the given buffer with content read from the media object. |
Field Detail |
public static final java.lang.String MIME_TYPE_UNKNOWN
Method Detail |
public byte[] getContent() throws MediaException (src)
ContentTooLargeException (src)
- if the resulting byte array
size exceeds the theoretical maximum Java array size of 2 GB.
ContentAccessException (src)
- if the content cannot be
accessed.
MediaException (src)
public MediaFormat (src) getFormat() throws MediaException (src)
FormatNotFoundException (src)
- if the file extension is not
registered with the media format registry.
MediaException (src)
public MediaHeader (src) getHeader() throws MediaException (src)
FormatNotFoundException (src)
- if the file extension is not
registered with the media format registry.
FormatSyntaxException (src)
- if the receiver's content does
not match the syntax defined for the receiver's media format.
FormatFeatureException (src)
- if the header cannot be
extracted because a vital feature of the media format involved is
not supported by the implementation.
ContentAccessException (src)
- if the actual content access
fails.
MediaException (src)
public java.lang.String getMimeType() throws MediaException (src)
FormatNotFoundException (src)
- if the receiver's media format
cannot be determined.
MediaException (src)
public java.lang.String getName() throws MediaException (src)
MediaException (src)
public Media (src) getProxy() throws MediaException (src)
MediaException (src)
public long getSize() throws MediaException (src)
ContentAccessException (src)
- if there's a problem accessing
the receiver's content.
MediaException (src)
public int readContent(long position, byte[] buffer) throws MediaException (src)
position
- the position in media to copy from.buffer
- the byte array to store content.
java.lang.IndexOutOfBoundsException
- if the given position is
negative or exceeding the content size.
java.lang.NullPointerException
- if the given buffer is null.
ContentAccessException (src)
- if the actual content access
fails.
MediaException (src)
public int readContent(long position, byte[] buffer, int offset, int length) throws MediaException (src)
position
- the position in media to copy from.buffer
- the byte array to store content.offset
- the offset in the buffer to begin storing content.length
- the number of bytes to copy from the content.
java.lang.IndexOutOfBoundsException
- if the given position is
negative or exceeding the content size, or in case the given
offset is negative or exceeding the buffer size.
java.lang.NegativeArraySizeException
- if the given length is
negative.
java.lang.NullPointerExcetion
- if the given buffer is null.
ContentAccessException (src)
- if the actual content access
fails.
MediaException (src)
|
||||||||||
PREV CLASS NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |