org.asteriskjava.util.internal
Class CustomSocketConnectionFacadeImpl

java.lang.Object
  extended by org.asteriskjava.util.internal.CustomSocketConnectionFacadeImpl
All Implemented Interfaces:
org.asteriskjava.util.SocketConnectionFacade

public class CustomSocketConnectionFacadeImpl
extends Object
implements org.asteriskjava.util.SocketConnectionFacade

Default implementation of the SocketConnectionFacade interface using java.io.

Version:
$Id: SocketConnectionFacadeImpl.java 1377 2009-10-17 03:24:49Z srt $
Author:
srt

Field Summary
static Pattern CRNL_PATTERN
           
static Pattern NL_PATTERN
           
 
Constructor Summary
CustomSocketConnectionFacadeImpl(String host, int port, boolean ssl, int timeout, int readTimeout)
          Creates a new instance for use with the Manager API that uses CRNL ("\r\n") as line delimiter.
CustomSocketConnectionFacadeImpl(String host, int port, boolean ssl, int timeout, int readTimeout, Pattern lineDelimiter)
          Creates a new instance for use with the Manager API that uses CRNL ("\r\n") as line delimiter.
 
Method Summary
 void close()
           
 void flush()
           
 InetAddress getLocalAddress()
           
 int getLocalPort()
           
 InetAddress getRemoteAddress()
           
 int getRemotePort()
           
 boolean isConnected()
           
 String readLine()
           
 void write(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRNL_PATTERN

public static final Pattern CRNL_PATTERN

NL_PATTERN

public static final Pattern NL_PATTERN
Constructor Detail

CustomSocketConnectionFacadeImpl

public CustomSocketConnectionFacadeImpl(String host,
                                        int port,
                                        boolean ssl,
                                        int timeout,
                                        int readTimeout)
                                 throws IOException
Creates a new instance for use with the Manager API that uses CRNL ("\r\n") as line delimiter.

Parameters:
host - the foreign host to connect to.
port - the foreign port to connect to.
ssl - true to use SSL, false otherwise.
timeout - 0 incidcates default
readTimeout - see Socket.setSoTimeout(int)
Throws:
IOException - if the connection cannot be established.

CustomSocketConnectionFacadeImpl

public CustomSocketConnectionFacadeImpl(String host,
                                        int port,
                                        boolean ssl,
                                        int timeout,
                                        int readTimeout,
                                        Pattern lineDelimiter)
                                 throws IOException
Creates a new instance for use with the Manager API that uses CRNL ("\r\n") as line delimiter.

Parameters:
host - the foreign host to connect to.
port - the foreign port to connect to.
ssl - true to use SSL, false otherwise.
timeout - 0 incidcates default
readTimeout - see Socket.setSoTimeout(int)
lineDelimiter - a Pattern for matching the line delimiter for the socket
Throws:
IOException - if the connection cannot be established.
Method Detail

readLine

public String readLine()
                throws IOException
Specified by:
readLine in interface org.asteriskjava.util.SocketConnectionFacade
Throws:
IOException

write

public void write(String s)
           throws IOException
Specified by:
write in interface org.asteriskjava.util.SocketConnectionFacade
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in interface org.asteriskjava.util.SocketConnectionFacade
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface org.asteriskjava.util.SocketConnectionFacade
Throws:
IOException

isConnected

public boolean isConnected()
Specified by:
isConnected in interface org.asteriskjava.util.SocketConnectionFacade

getLocalAddress

public InetAddress getLocalAddress()
Specified by:
getLocalAddress in interface org.asteriskjava.util.SocketConnectionFacade

getLocalPort

public int getLocalPort()
Specified by:
getLocalPort in interface org.asteriskjava.util.SocketConnectionFacade

getRemoteAddress

public InetAddress getRemoteAddress()
Specified by:
getRemoteAddress in interface org.asteriskjava.util.SocketConnectionFacade

getRemotePort

public int getRemotePort()
Specified by:
getRemotePort in interface org.asteriskjava.util.SocketConnectionFacade


Copyright © 2011 OneBusAway. All Rights Reserved.