public class DataLink
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DATALINK_PROTOCOL |
static java.lang.String |
DEFAULT_HOST |
static int |
DEFAULT_PORT |
static int |
DEFAULT_TIMEOUT_SECOND |
static java.lang.String |
EEYORE_HOST |
static int |
EEYORE_PORT |
static java.lang.String |
ENDSTREAM |
static java.lang.String |
ERROR |
static java.lang.String |
ID |
static java.lang.String |
INFO |
static java.lang.String |
IRIS_HOST |
static int |
IRIS_PORT |
static java.lang.String |
MATCH |
static int |
MAX_PROC_NUM |
static java.lang.String |
MSEED_TYPE |
static java.lang.String |
OK |
static java.lang.String |
PACKET |
static java.lang.String |
QUERY_MODE |
static java.lang.String |
REJECT |
static java.lang.String |
STREAM |
static java.lang.String |
STREAM_MODE |
static java.lang.String |
USER_BROWSER |
Constructor and Description |
---|
DataLink()
default of IRIS DMC
|
DataLink(java.lang.String host)
uses the default port of 18000
|
DataLink(java.lang.String host,
int port)
Open DataLink socket connection
|
DataLink(java.lang.String host,
int port,
int timeoutSeconds)
Open DataLink socket connection
|
DataLink(java.lang.String host,
int port,
int timeoutSeconds,
boolean verbose) |
Modifier and Type | Method and Description |
---|---|
boolean |
available()
true if there is enough data in the instream to possibly read a data record.
|
int |
availableBytes() |
DataLinkResponse |
awaitDLCommand(java.lang.String command,
java.lang.String dataString) |
void |
close()
Send end and close connection.
|
byte[] |
encodeDLCommand(java.lang.String command,
java.lang.String dataString)
encodes command with optional data section as
a string.
|
void |
endStream() |
int |
getClientIdNum() |
java.lang.String |
getHost() |
int |
getPort() |
java.lang.String |
getServerId() |
java.lang.String |
getUsername() |
java.io.PrintWriter |
getVerboseWriter() |
boolean |
isConnected() |
boolean |
isVerbose() |
void |
match(java.lang.String matchRegEx) |
DataLinkResponse |
readPacket()
Read a packet.
|
void |
reconnect()
Would be really nice to keep state and reconnect plus backfill, but...
|
void |
reject(java.lang.String rejectRegEx) |
void |
sendDLCommand(java.lang.String command,
java.lang.String dataString)
Sends a DL Command and awaits the response, either OK or ERROR.
|
void |
sendId() |
void |
setVerbose(boolean verbose) |
void |
setVerboseWriter(java.io.PrintWriter verboseWriter) |
void |
stream() |
void |
verbose(java.lang.String message) |
public static final java.lang.String IRIS_HOST
public static final int IRIS_PORT
public static final java.lang.String EEYORE_HOST
public static final int EEYORE_PORT
public static final java.lang.String DEFAULT_HOST
public static final int DEFAULT_PORT
public static final int DEFAULT_TIMEOUT_SECOND
public static final java.lang.String DATALINK_PROTOCOL
public static final java.lang.String QUERY_MODE
public static final java.lang.String STREAM_MODE
public static final int MAX_PROC_NUM
public static final java.lang.String USER_BROWSER
public static final java.lang.String ID
public static final java.lang.String OK
public static final java.lang.String ERROR
public static final java.lang.String INFO
public static final java.lang.String MATCH
public static final java.lang.String REJECT
public static final java.lang.String PACKET
public static final java.lang.String STREAM
public static final java.lang.String ENDSTREAM
public static final java.lang.String MSEED_TYPE
public DataLink() throws DataLinkException
DataLinkException
- if unable to connectpublic DataLink(java.lang.String host) throws DataLinkException
host
- host to connect toDataLinkException
- if unable to connectpublic DataLink(java.lang.String host, int port) throws DataLinkException
host
- host to connect toport
- port to connect toDataLinkException
- if unable to connectpublic DataLink(java.lang.String host, int port, int timeoutSeconds) throws DataLinkException
host
- host to connect toport
- port to connect totimeoutSeconds
- timeout valueDataLinkException
- if unable to connectpublic DataLink(java.lang.String host, int port, int timeoutSeconds, boolean verbose) throws DataLinkException
DataLinkException
public DataLinkResponse readPacket() throws java.io.IOException, DataLinkException
java.io.IOException
- if an I/O Exception occurs.DataLinkException
- if not connectedreadPacket()
public void stream() throws DataLinkException
DataLinkException
public void endStream() throws DataLinkException
DataLinkException
public void match(java.lang.String matchRegEx) throws DataLinkException
DataLinkException
public void reject(java.lang.String rejectRegEx) throws DataLinkException
DataLinkException
public boolean available() throws java.io.IOException
java.io.IOException
- if input stream throwspublic int availableBytes() throws java.io.IOException
java.io.IOException
- from underlying input streampublic void close()
public boolean isConnected()
public void reconnect() throws java.io.IOException, DataLinkException
java.io.IOException
- from underlying socketDataLinkException
- if error with datalink protocolpublic byte[] encodeDLCommand(java.lang.String command, java.lang.String dataString) throws DataLinkException
command
- command to senddataString
- optional dataDataLinkException
- if command is too longpublic void sendDLCommand(java.lang.String command, java.lang.String dataString) throws DataLinkException
command
- command to senddataString
- optional associated dataDataLinkException
- if error sending or with responsepublic DataLinkResponse awaitDLCommand(java.lang.String command, java.lang.String dataString) throws DataLinkException
DataLinkException
public void sendId() throws DataLinkException
DataLinkException
public void verbose(java.lang.String message)
public boolean isVerbose()
public void setVerbose(boolean verbose)
public java.io.PrintWriter getVerboseWriter()
public void setVerboseWriter(java.io.PrintWriter verboseWriter)
public java.lang.String getHost()
public int getPort()
public java.lang.String getServerId()
public int getClientIdNum()
public java.lang.String getUsername()