net.wimpi.modbus.io
Class ASCIIOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
net.wimpi.modbus.io.ASCIIOutputStream
- All Implemented Interfaces:
- Closeable, Flushable
public class ASCIIOutputStream
- extends FilterOutputStream
Class implementing a specialized OutputStream which
encodes bytes written to the stream into two hexadecimal
characters each.
Note that the "virtual" characters FRAME_START and FRAME_END
are exceptions, they are translated to the respective characters
as given by the specification.
- Version:
- 1.2 (@date@)
- Author:
- Dieter Wimberger
- See Also:
ModbusASCIITransport.FRAME_START,
ModbusASCIITransport.FRAME_END
|
Method Summary |
void |
write(byte[] data)
Writes an array of bytes encoded as two hexadecimal
characters to the raw output stream. |
void |
write(byte[] data,
int off,
int len)
Writes an array of bytes encoded as two hexadecimal
characters to the raw output stream. |
void |
write(int b)
Writes a byte encoded as two hexadecimal characters to
the raw output stream. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ASCIIOutputStream
public ASCIIOutputStream(OutputStream out)
- Constructs a new ASCIIOutputStream instance
writing to the given OutputStream.
- Parameters:
out - a base output stream instance to be wrapped.
write
public void write(int b)
throws IOException
- Writes a byte encoded as two hexadecimal characters to
the raw output stream.
- Overrides:
write in class FilterOutputStream
- Parameters:
b - the byte to be written as int.
- Throws:
IOException - if an I/O error occurs.
write
public void write(byte[] data)
throws IOException
- Writes an array of bytes encoded as two hexadecimal
characters to the raw output stream.
- Overrides:
write in class FilterOutputStream
- Parameters:
data - the byte[] to be written.
- Throws:
IOException - if an I/O error occurs.
write
public void write(byte[] data,
int off,
int len)
throws IOException
- Writes an array of bytes encoded as two hexadecimal
characters to the raw output stream.
- Overrides:
write in class FilterOutputStream
- Parameters:
data - the byte[] to be written.off - the offset into the data to start writing from.len - the number of bytes to be written from off.
- Throws:
IOException - if an I/O error occurs.
Copyright © 2012. All Rights Reserved.