org.mobicents.media.server.impl.resource.zap
Class Channel

java.lang.Object
  extended by org.mobicents.media.server.impl.resource.zap.Channel
All Implemented Interfaces:
org.mobicents.protocols.ss7.mtp.Mtp1, org.mobicents.protocols.stream.api.Stream

public class Channel
extends java.lang.Object
implements org.mobicents.protocols.ss7.mtp.Mtp1


Field Summary
protected  int fd
           
protected  org.mobicents.protocols.stream.api.SelectorKey selectorKey
           
 
Constructor Summary
Channel()
           
 
Method Summary
 void close()
           
 void closeChannel(int fd)
          Closes this pipe.
 void doRegister(int fd)
          Registers pipe for polling.
protected  void doRegister(org.mobicents.protocols.stream.api.StreamSelector selector)
           
 void doUnregister(int fd)
          Unregisters pipe from polling.
protected  void doUnregister(org.mobicents.protocols.stream.api.StreamSelector selector)
           
 int getChannelID()
           
 int getCode()
           
 org.mobicents.protocols.ss7.mtp.Mtp2 getLink()
           
 java.lang.String getLinkName()
           
 int getSpan()
           
 boolean isReadable()
           
 boolean isWriteable()
           
 void open()
           
 int openChannel(int id)
          Opens this channel and prepares it for reading.
 org.mobicents.protocols.stream.api.SelectorProvider provider()
           
 int read(byte[] buffer)
          Reads data from this pipe.
 int readData(int fd, byte[] buffer)
           
 org.mobicents.protocols.stream.api.SelectorKey register(org.mobicents.protocols.stream.api.StreamSelector selector)
           
 void setChannelID(int channelID)
           
 void setCode(int code)
           
 void setLink(org.mobicents.protocols.ss7.mtp.Mtp2 link)
           
 void setLinkName(java.lang.String linkName)
           
 void setSpan(int span)
           
 java.lang.String toString()
           
 int write(byte[] buffer)
          Writes specified data to the pipe.
 void write(byte[] data, int len)
           
 void writeData(int fd, byte[] buffer, int len)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fd

protected int fd

selectorKey

protected org.mobicents.protocols.stream.api.SelectorKey selectorKey
Constructor Detail

Channel

public Channel()
Method Detail

getSpan

public int getSpan()

setSpan

public void setSpan(int span)

getChannelID

public int getChannelID()

setChannelID

public void setChannelID(int channelID)

setCode

public void setCode(int code)

getCode

public int getCode()
Specified by:
getCode in interface org.mobicents.protocols.ss7.mtp.Mtp1

setLinkName

public void setLinkName(java.lang.String linkName)

getLinkName

public java.lang.String getLinkName()

open

public void open()
Specified by:
open in interface org.mobicents.protocols.ss7.mtp.Mtp1

openChannel

public int openChannel(int id)
Opens this channel and prepares it for reading.

Parameters:
path - the path to the device.

read

public int read(byte[] buffer)
         throws java.io.IOException
Reads data from this pipe.

Specified by:
read in interface org.mobicents.protocols.ss7.mtp.Mtp1
Specified by:
read in interface org.mobicents.protocols.stream.api.Stream
Parameters:
buffer - the byte buffer to read data.
Returns:
the number of bytes actualy read.
Throws:
java.io.IOException

readData

public int readData(int fd,
                    byte[] buffer)

write

public int write(byte[] buffer)
          throws java.io.IOException
Writes specified data to the pipe.

Specified by:
write in interface org.mobicents.protocols.stream.api.Stream
Parameters:
buffer - the buffer with data to write
len - the length of the buffer.
Throws:
java.io.IOException

writeData

public void writeData(int fd,
                      byte[] buffer,
                      int len)

doRegister

public void doRegister(int fd)
Registers pipe for polling.

Parameters:
fd - the file descriptor.

doUnregister

public void doUnregister(int fd)
Unregisters pipe from polling.

Parameters:
fd - the file descriptor.

close

public void close()
Specified by:
close in interface org.mobicents.protocols.ss7.mtp.Mtp1
Specified by:
close in interface org.mobicents.protocols.stream.api.Stream

closeChannel

public void closeChannel(int fd)
Closes this pipe.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setLink

public void setLink(org.mobicents.protocols.ss7.mtp.Mtp2 link)
Specified by:
setLink in interface org.mobicents.protocols.ss7.mtp.Mtp1

getLink

public org.mobicents.protocols.ss7.mtp.Mtp2 getLink()
Specified by:
getLink in interface org.mobicents.protocols.ss7.mtp.Mtp1

doRegister

protected void doRegister(org.mobicents.protocols.stream.api.StreamSelector selector)

doUnregister

protected void doUnregister(org.mobicents.protocols.stream.api.StreamSelector selector)

isReadable

public boolean isReadable()

isWriteable

public boolean isWriteable()

provider

public org.mobicents.protocols.stream.api.SelectorProvider provider()
Specified by:
provider in interface org.mobicents.protocols.stream.api.Stream

register

public org.mobicents.protocols.stream.api.SelectorKey register(org.mobicents.protocols.stream.api.StreamSelector selector)
                                                        throws java.io.IOException
Specified by:
register in interface org.mobicents.protocols.stream.api.Stream
Throws:
java.io.IOException

write

public void write(byte[] data,
                  int len)
           throws java.io.IOException
Specified by:
write in interface org.mobicents.protocols.ss7.mtp.Mtp1
Throws:
java.io.IOException


Copyright © 2010. All Rights Reserved.