KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > media > format > EmbeddedMediaFormat


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license. See terms of license at gnu.org.
5  */

6
7 package org.jboss.media.format;
8
9 import java.io.InputStream JavaDoc;
10 import java.net.URL JavaDoc;
11
12 import javax.emb.GenericMediaFormat;
13 import javax.emb.Media;
14 import javax.emb.MediaException;
15 import javax.emb.MediaFormat;
16 import javax.emb.MediaHeader;
17 import javax.emb.MediaSegment;
18
19 /**
20  * Facade around <code>GenericMediaFormat</code> to represent embedded media
21  * formats.
22  *
23  * @version <tt>$Revision: 1.2 $</tt>
24  * @author <a HREF="mailto:ricardoarguello@users.sourceforge.net">Ricardo
25  * ArgŁello</a>
26  */

27 public abstract class EmbeddedMediaFormat implements MediaFormat
28 {
29    private MediaFormat mediaFormat;
30
31    public EmbeddedMediaFormat()
32    {
33       mediaFormat = new GenericMediaFormat();
34    }
35
36    public final byte[] assembleContent(
37       URL JavaDoc mediaLocation,
38       MediaSegment[] mediaSegments)
39       throws MediaException
40    {
41       return mediaFormat.assembleContent(mediaLocation, mediaSegments);
42    }
43
44    public final MediaSegment[] disassembleContent(
45       URL JavaDoc mediaLocation,
46       byte[] mediaContent)
47       throws MediaException
48    {
49       return mediaFormat.disassembleContent(mediaLocation, mediaContent);
50    }
51
52    public abstract MediaHeader extractHeader(InputStream JavaDoc content)
53       throws MediaException;
54
55    public Media extractProxy(InputStream JavaDoc content) throws MediaException
56    {
57       return mediaFormat.extractProxy(content);
58    }
59
60    public abstract String JavaDoc getDefaultMimeType();
61
62    public final boolean isEmbedded()
63    {
64       return true;
65    }
66
67    public abstract boolean isStreamingDesirable();
68 }
69
Popular Tags