javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/BufferDataSource.java
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 15:09:22 +0300
branchRCL_3
changeset 65 ae942d28ec0e
permissions -rw-r--r--
Revision: v2.2.11 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
65
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
* All rights reserved.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
*
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
*
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
* Contributors:
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
*
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
* Description:  Buffered DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
*
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    16
*/
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
package com.nokia.microedition.media;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
import javax.microedition.media.Control;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
import javax.microedition.media.protocol.DataSource;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
import javax.microedition.media.protocol.SourceStream;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
import java.io.IOException;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
/**
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
 * BufferDataSource is used to read header from DataSource's SourceStream.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
 * This class delegates all method calls to DataSource given in constructor
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
 * except getStream method which returns buffered SourceStream.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
 */
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
public class BufferDataSource extends DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
{
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
    // delegated source
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
    protected DataSource iDataSource;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
    // buffers DataSource's first stream.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    37
    protected BufferSourceStream iSourceStream;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
    /**
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
     * Constructor.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
     * @param aDataSource delegated DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    42
     */
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
    public BufferDataSource(DataSource aDataSource) throws IOException
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
        super(aDataSource.getLocator());
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
        iDataSource = aDataSource;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    47
        SourceStream ss = aDataSource.getStreams()[ 0 ];
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
        iSourceStream = new BufferSourceStream(ss);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    51
    /**
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    52
     * Return header data.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    53
     * @return header data
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    54
     */
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
    public byte[] getHeader() throws IOException
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
        return iSourceStream.getHeader();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    58
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    59
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
    public int readAndBuffer(byte[] aBuffer, int aOffset, int aLength) throws IOException
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    61
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    62
        return iSourceStream.readAndBuffer(aBuffer, aOffset, aLength);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    63
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
    /**
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
     * from DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
     * @return Content Type
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
     * @see DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
     */
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
    public String getContentType()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
        return iDataSource.getContentType();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
    /**
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
     * from DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
     * Connect to the stream
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
     * @throws IOException
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
     * @see DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
     */
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
    public void connect() throws IOException
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
        iDataSource.connect();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
    /**
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
     * from DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
     * Disconnect from the stream
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
     */
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
    public void disconnect()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
        iDataSource.disconnect();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
    /**
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
     * from DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
     * Put DataSource to STARTED state
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
     * @throws IOException Throw if DataSource is in wrong state
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
     * @see DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
     */
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
    public void start() throws IOException
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   103
        iDataSource.start();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
    /**
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   107
     * from DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
     * Stops DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
     * @see DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
     */
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
    public void stop() throws IOException
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
        iDataSource.stop();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   114
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   115
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    /**
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   117
     * from DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   118
     * return sourceStreams of the DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
     *
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   120
     * @return set of source streams
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   121
     * @see DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   122
     */
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   123
    public SourceStream[] getStreams()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   124
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   125
        // return all streams from delegated DataSource except first
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
        // buffered stream.
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
        SourceStream[] originalStreams = iDataSource.getStreams();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
        SourceStream[] streams = new SourceStream[ originalStreams.length ];
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
        System.arraycopy(originalStreams, 0,
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
                         streams, 0, originalStreams.length);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
        streams[ 0 ] = iSourceStream;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
        return streams;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   134
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   135
    /**
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
     * from interface Controllable
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
     * Method return controls of the DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
     * @return Control
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
     * @see Controllable
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
     * @see DataSource
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
     */
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
    public Control[] getControls()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   143
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   144
        return iDataSource.getControls();
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   146
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   147
    /**
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
     * from interface Controllable
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   149
     * Return a control by the Control Type, not supported
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   150
     * @param controlType type of the control
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   151
     * @return Control
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   152
     */
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   153
    public Control getControl(String aControlType)
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   154
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   155
        return iDataSource.getControl(aControlType);
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   156
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   157
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   158
    public DataSource getDataSource()
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   159
    {
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   160
        return iDataSource;
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   161
    }
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   162
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   163
}
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   164
// End of File
ae942d28ec0e Revision: v2.2.11
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   165