public abstract class Port extends java.lang.Object implements PortInterface
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
cvsRev |
Constructor and Description |
---|
Port() |
Modifier and Type | Method and Description |
---|---|
int |
available()
This will return the number of bytes available.
|
java.io.InputStream |
getInputStream()
The input stream associated with this port.
|
java.lang.String |
getName()
Returns the name of this component.
|
java.io.OutputStream |
getOutputStream()
The output stream associated with this port.
|
int |
getPort()
This is the port number.
|
PortPoolInterface |
getPortPool()
Returns the port pool that this port was served from.
|
boolean |
hasError()
Returns true if an error has been detected on the port.
|
int |
read()
This will read a single byte.
|
int |
read(byte[] b)
This will read an array of bytes and place them into the given array.
|
int |
read(byte[] b,
int off,
int len)
This will read an array of bytes and place them into the array of bytes
at a given offset (up to the length).
|
byte[] |
readAndWait(int length,
int timeout,
int interCharacterTimeout)
This will wait until we have received data until either the
timeout or the interCharacterTimeout expire
or length characters are read. |
byte[] |
readCurrent()
This will create a byte array of the current size of the buffer (filled).
|
void |
setError(java.lang.Object errorObject)
Sets an error on the port.
|
void |
setInputStream(java.io.InputStream is)
The input stream associated with this port.
|
void |
setOutputStream(java.io.OutputStream os)
The output stream associated with this port.
|
void |
setPortPool(PortPoolInterface portPool)
Sets the port pool that this port was served from.
|
void |
setThread(java.lang.Thread thread)
Set the thread that owns this port.
|
void |
write(byte b)
This will write a single byte.
|
void |
write(byte[] b)
This will write a single byte.
|
void |
write(byte[] b,
int offset,
int length)
This will write an array of bytes.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
public static final java.lang.String cvsRev
public int available() throws java.io.IOException
available
in interface PortInterface
java.io.IOException
public java.io.InputStream getInputStream()
public java.lang.String getName()
getName
in interface PortInterface
public java.io.OutputStream getOutputStream()
public int getPort()
public PortPoolInterface getPortPool()
getPortPool
in interface PortInterface
public boolean hasError()
hasError
in interface PortInterface
public int read() throws java.io.IOException
read
in interface PortInterface
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in interface PortInterface
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in interface PortInterface
java.io.IOException
public byte[] readAndWait(int length, int timeout, int interCharacterTimeout) throws java.io.IOException
timeout
or the interCharacterTimeout
expire
or length
characters are read. The timeout values are
in milliseconds. The call will wait for up to timeout
for
a character to be available. If no characters are available then the
method will return with a null value. If character are available, then
the method will read characters until either length
characters have been read or no characters have been available for
interCharacterTimeout
milliseconds. If the
interCharacterTimeout
expires then the returned array may
have less than length
characters available.readAndWait
in interface PortInterface
length
- the maximum number of characters to readtimeout
- the maximum time to wait for the first character to be
available at the portinterCharacterTimeout
- the maximum time to wait for subsequent
characters to be available at the portlength
if the interCharacterTimeout expired. It will be
null if the timeout expired.java.io.IOException
- thrown by the underlying portpublic byte[] readCurrent() throws java.io.IOException
java.io.IOException
public void setError(java.lang.Object errorObject)
setError
in interface PortInterface
public void setInputStream(java.io.InputStream is)
public void setOutputStream(java.io.OutputStream os)
public void setPortPool(PortPoolInterface portPool)
setPortPool
in interface PortInterface
public void setThread(java.lang.Thread thread)
setThread
in interface PortInterface
public void write(byte b) throws java.io.IOException
write
in interface PortInterface
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in interface PortInterface
java.io.IOException
public void write(byte[] b, int offset, int length) throws java.io.IOException
write
in interface PortInterface
java.io.IOException
Copyright © 1999-2025 ErgoTech Systems, Inc. All Rights Reserved.