|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This class is an imlementation of DataSource |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 package com.nokia.microedition.media; |
|
20 |
|
21 import javax.microedition.media.Control; |
|
22 import javax.microedition.media.protocol.DataSource; |
|
23 import javax.microedition.media.protocol.SourceStream; |
|
24 import java.io.IOException; |
|
25 |
|
26 /** |
|
27 * DataSource which has InputStreamSourceStream. |
|
28 */ |
|
29 public class InputStreamDataSource extends DataSource |
|
30 { |
|
31 // DataSource's stream |
|
32 protected InputStreamSourceStream iSourceStream; |
|
33 |
|
34 // string that describes the content-type of the media that the source |
|
35 // is providing. |
|
36 protected String iContentType; |
|
37 |
|
38 /** |
|
39 * Constructor. |
|
40 * @param aSourceStream SourceSteam |
|
41 * @param aType Content type. |
|
42 */ |
|
43 public InputStreamDataSource(InputStreamSourceStream aSourceStream, |
|
44 String aType) |
|
45 { |
|
46 super(null); // no locator |
|
47 iSourceStream = aSourceStream; |
|
48 iContentType = aType; |
|
49 } |
|
50 |
|
51 /** |
|
52 * Constructor with Locator and stream |
|
53 * @param aLocator Locator |
|
54 * @param aSourceStream SourceSteam |
|
55 * @param aType Content type. |
|
56 */ |
|
57 public InputStreamDataSource(String aLocator, |
|
58 InputStreamSourceStream aSourceStream, |
|
59 String aType) |
|
60 { |
|
61 super(aLocator); |
|
62 iSourceStream = aSourceStream; |
|
63 iContentType = aType; |
|
64 } |
|
65 |
|
66 |
|
67 /** |
|
68 * Constructor with locator |
|
69 * @param aLocator Locator |
|
70 */ |
|
71 public InputStreamDataSource(String aLocator) |
|
72 { |
|
73 super(aLocator); |
|
74 } |
|
75 |
|
76 /** |
|
77 * from DataSource |
|
78 * @return Content Type |
|
79 * @see DataSource |
|
80 */ |
|
81 public String getContentType() |
|
82 { |
|
83 return iContentType; |
|
84 } |
|
85 |
|
86 /** |
|
87 * from DataSource |
|
88 * Connect to the stream |
|
89 * @throws IOException |
|
90 * @see DataSource |
|
91 */ |
|
92 public void connect() throws IOException |
|
93 { |
|
94 } |
|
95 |
|
96 /** |
|
97 * from DataSource |
|
98 * Disconnect from the stream |
|
99 */ |
|
100 public void disconnect() |
|
101 { |
|
102 } |
|
103 |
|
104 /** |
|
105 * from DataSource |
|
106 * Put DataSource to STARTED state |
|
107 * @throws IOException Throw if DataSource is in wrong state |
|
108 * @see DataSource |
|
109 */ |
|
110 public void start() throws IOException |
|
111 { |
|
112 } |
|
113 |
|
114 /** |
|
115 * from DataSource |
|
116 * Stops DataSource |
|
117 * @see DataSource |
|
118 */ |
|
119 public void stop() |
|
120 { |
|
121 } |
|
122 |
|
123 /** |
|
124 * from DataSource |
|
125 * return sourceStreams of the DataSource |
|
126 * |
|
127 * @exception IllegalStateException Thrown if the source is not connected. |
|
128 * @return set of source streams |
|
129 * @see DataSource |
|
130 */ |
|
131 public SourceStream[] getStreams() |
|
132 { |
|
133 SourceStream[] streams = new SourceStream[ 1 ]; |
|
134 streams[ 0 ] = iSourceStream; |
|
135 return streams; |
|
136 } |
|
137 |
|
138 /** |
|
139 * from interface Controllable |
|
140 * Method return controls of the DataSource |
|
141 * @return Control |
|
142 * @see Controllable |
|
143 * @see DataSource |
|
144 */ |
|
145 public Control[] getControls() |
|
146 { |
|
147 return new Control[ 0 ]; |
|
148 } |
|
149 |
|
150 /** |
|
151 * from interface Controllable |
|
152 * Return a control by the Control Type, not supported |
|
153 * @param aControlType type of the control |
|
154 * @return Control |
|
155 */ |
|
156 public Control getControl(String aControlType) |
|
157 { |
|
158 return iSourceStream.getControl("SeekControl"); |
|
159 } |
|
160 |
|
161 } |
|
162 // End of File |
|
163 |