com.sun.media
接口 Connector

所有已知子接口:
InputConnector, OutputConnector
所有已知实现类:
BasicConnector, BasicInputConnector, BasicOutputConnector

public interface Connector

Defines common interface to input and output Connectors. Inter Module Connection is made of InputConnector and OutputConnector and is essentially a cyclic queue of references to Buffer Objects.
The queue is constructed at the Connectors connectTo() method, so the suggested size should be set before that.

Note that these connectors are almost symetrical so they can support both push and pull connection.
In addition the two threads sync. mechanism is also supported by this suggested API.

另请参见:
Module, InputConnector, OutputConnector, Format

字段摘要
static int ProtocolPush
          constant to indicate that this connector runs on "Push" protocol.
static int ProtocolSafe
          constant to indicate that this connector runs on "Safe" protocol.
 
方法摘要
 java.lang.Object getCircularBuffer()
          returns the circular buffer Object which is locked (by wait()/notify() )during safe data transfer.
 Format getFormat()
          The selected format.
 Module getModule()
          Returns the Module which registered this Connector.
 java.lang.String getName()
          returns the name of this Connector in the owning Module
 int getProtocol()
          returns the data transfer protocol used by this connector.
 int getSize()
          gets the minimum number of buffer objects this Connector should create.
 void reset()
          restores this Connector to its initial state: removes all the buffer locks.
 void setCircularBuffer(java.lang.Object circularBuffer)
          Sets the circular buffer object of the connection.
 void setFormat(Format format)
          Selects a format for this Connector (the default is null).
 void setModule(Module module)
          sets the Module which registered this Connector.
 void setName(java.lang.String name)
          sets the name of this Connector.
 void setProtocol(int protocol)
          determines the data transfer protocol used by this connector.
 void setSize(int numOfBufferObjects)
          sets the minimum number of buffer objects this Connector should create.
 

字段详细信息

ProtocolPush

static final int ProtocolPush
constant to indicate that this connector runs on "Push" protocol. meaning writing to this connector is propagated to the connected InputConnector.

另请参见:
常量字段值

ProtocolSafe

static final int ProtocolSafe
constant to indicate that this connector runs on "Safe" protocol. meaning reading and writing from this connection is done using thread safe monitor.

另请参见:
常量字段值
方法详细信息

setFormat

void setFormat(Format format)
Selects a format for this Connector (the default is null). The setFormat() method is typically called by the Manager as part of the Connector connection method call. The connector should delegate this call to its owning Module.


getFormat

Format getFormat()
The selected format. If setFormat() has not been called, getFormat() will return null.

返回:
the currently selected format.

setSize

void setSize(int numOfBufferObjects)
sets the minimum number of buffer objects this Connector should create. The default value should be one buffer object.


getSize

int getSize()
gets the minimum number of buffer objects this Connector should create.


reset

void reset()
restores this Connector to its initial state: removes all the buffer locks. this method is typically called when the owning Module is requested to reset.


getName

java.lang.String getName()
returns the name of this Connector in the owning Module


setName

void setName(java.lang.String name)
sets the name of this Connector. Called by the owning Module registerConnector() method


setProtocol

void setProtocol(int protocol)
determines the data transfer protocol used by this connector.
Perhaps the only way to change the protocol is in the constructor ?

参数:
protocol - either ProtocolPush, ProtocolSafe

getProtocol

int getProtocol()
returns the data transfer protocol used by this connector.
either ProtocolPush, ProtocolSafe


getCircularBuffer

java.lang.Object getCircularBuffer()
returns the circular buffer Object which is locked (by wait()/notify() )during safe data transfer.
This method should not really be part of the API, but it is put here in order to remove implementation dependencies.


setCircularBuffer

void setCircularBuffer(java.lang.Object circularBuffer)
Sets the circular buffer object of the connection. This method is called only by the OutputConnector.connectTo() method.
This method should not really be part of the API, but it is put here in order to remove implementation dependencies.

参数:
circularBuffer - the circular buffer used by this Connection

setModule

void setModule(Module module)
sets the Module which registered this Connector.


getModule

Module getModule()
Returns the Module which registered this Connector.