org.asteriskjava.util.internal
Class CustomSocketConnectionFacadeImpl
java.lang.Object
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
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CRNL_PATTERN
public static final Pattern CRNL_PATTERN
NL_PATTERN
public static final Pattern NL_PATTERN
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 defaultreadTimeout
- 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 defaultreadTimeout
- see Socket.setSoTimeout(int)
lineDelimiter
- a Pattern
for matching the line delimiter for the socket
- Throws:
IOException
- if the connection cannot be established.
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 © 2012 OneBusAway. All Rights Reserved.