Class AbstractSerialDataWriter
- java.lang.Object
- 
- com.pi4j.io.serial.impl.AbstractSerialDataWriter
 
- 
- All Implemented Interfaces:
- SerialDataWriter
 - Direct Known Subclasses:
- AbstractSerialDataReaderWriter
 
 public abstract class AbstractSerialDataWriter extends Object implements SerialDataWriter 
- 
- 
Constructor SummaryConstructors Constructor Description AbstractSerialDataWriter()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected CharSequenceappendNewLine(CharSequence data)voidwrite(byte... data)Sends one of more bytes to the serial device identified by the given file descriptor.voidwrite(byte[]... data)Sends one of more bytes arrays to the serial device identified by the given file descriptor.abstract voidwrite(byte[] data, int offset, int length)Sends an array of bytes to the serial port/device identified by the given file descriptor.voidwrite(char... data)Sends an array of ASCII characters to the serial port/device identified by the given file descriptor.voidwrite(InputStream input)Read content from an input stream of data and write it to the serial port transmit buffer.voidwrite(CharSequence... data)Sends one or more ASCII string objects to the serial port/device identified by the given file descriptor.voidwrite(ByteBuffer... data)Read the content of byte buffer and write the data to the serial port transmit buffer.voidwrite(CharBuffer... data)Sends one or more ASCII CharBuffers to the serial port/device identified by the given file descriptor.voidwrite(Charset charset, char... data)Sends an array of characters to the serial port/device identified by the given file descriptor.voidwrite(Charset charset, char[] data, int offset, int length)Sends an array of characters to the serial port/device identified by the given file descriptor.voidwrite(Charset charset, CharSequence... data)Sends one or more string objects to the serial port/device identified by the given file descriptor.voidwrite(Charset charset, CharBuffer... data)Sends one or more CharBuffers to the serial port/device identified by the given file descriptor.voidwrite(Charset charset, Collection<? extends CharSequence> data)Sends a collection of string objects to the serial port/device identified by the given file descriptor.voidwrite(Collection<? extends CharSequence> data)Sends a collection of ASCII string objects to the serial port/device identified by the given file descriptor.voidwriteln(CharSequence... data)Sends one or more ASCII string objects each appended with a line terminator (CR+LF) to the serial port/device.voidwriteln(Charset charset, CharSequence... data)Sends one or more string objects each appended with a line terminator (CR+LF) to the serial port/device.voidwriteln(Charset charset, Collection<? extends CharSequence> data)Sends a collection of string objects each appended with a line terminator (CR+LF) to the serial port/device.voidwriteln(Collection<? extends CharSequence> data)Sends a collection of ASCII string objects each appended with a line terminator (CR+LF) to the serial port/device.
 
- 
- 
- 
Method Detail- 
writepublic abstract void write(byte[] data, int offset, int length) throws IllegalStateException, IOExceptionSends an array of bytes to the serial port/device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- data- A ByteBuffer of data to be transmitted.
- offset- The starting index (inclusive) in the array to send from.
- length- The number of bytes from the byte array to transmit to the serial port.
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(byte... data) throws IllegalStateException, IOExceptionSends one of more bytes to the serial device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- data- One or more bytes (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(byte[]... data) throws IllegalStateException, IOExceptionSends one of more bytes arrays to the serial device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- data- One or more byte arrays of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(ByteBuffer... data) throws IllegalStateException, IOException Read the content of byte buffer and write the data to the serial port transmit buffer. (The buffer is read from the current position up to the 'limit' value, not the 'capacity'. You may need to rewind() or flip() the byte buffer if you have just written to it.)- Specified by:
- writein interface- SerialDataWriter
- Parameters:
- data- A ByteBuffer of data to be transmitted.
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(InputStream input) throws IllegalStateException, IOException Read content from an input stream of data and write it to the serial port transmit buffer.- Specified by:
- writein interface- SerialDataWriter
- Parameters:
- input- An InputStream of data to be transmitted
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(Charset charset, char[] data, int offset, int length) throws IllegalStateException, IOException Sends an array of characters to the serial port/device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- charset- The character set to use for encoding/decoding bytes to/from text characters
- data- An array of chars to be decoded into bytes and transmitted.
- offset- The starting index (inclusive) in the array to send from.
- length- The number of characters from the char array to transmit to the serial port.
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(Charset charset, char... data) throws IllegalStateException, IOException Sends an array of characters to the serial port/device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- charset- The character set to use for encoding/decoding bytes to/from text characters
- data- One or more characters (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(char... data) throws IllegalStateException, IOExceptionSends an array of ASCII characters to the serial port/device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- data- One or more ASCII characters (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(Charset charset, CharBuffer... data) throws IllegalStateException, IOException Sends one or more CharBuffers to the serial port/device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- charset- The character set to use for encoding/decoding bytes to/from text characters
- data- One or more CharBuffers (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(CharBuffer... data) throws IllegalStateException, IOException Sends one or more ASCII CharBuffers to the serial port/device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- data- One or more ASCII CharBuffers (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(Charset charset, CharSequence... data) throws IllegalStateException, IOException Sends one or more string objects to the serial port/device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- charset- The character set to use for encoding/decoding bytes to/from text characters
- data- One or more string objects (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(CharSequence... data) throws IllegalStateException, IOException Sends one or more ASCII string objects to the serial port/device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- data- One or more ASCII string objects (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(Charset charset, Collection<? extends CharSequence> data) throws IllegalStateException, IOException Sends a collection of string objects to the serial port/device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- charset- The character set to use for encoding/decoding bytes to/from text characters
- data- A collection of string objects (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writepublic void write(Collection<? extends CharSequence> data) throws IllegalStateException, IOException Sends a collection of ASCII string objects to the serial port/device identified by the given file descriptor. - Specified by:
- writein interface- SerialDataWriter
- Parameters:
- data- A collection of string objects (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
appendNewLineprotected CharSequence appendNewLine(CharSequence data) 
 - 
writelnpublic void writeln(Charset charset, CharSequence... data) throws IllegalStateException, IOException Sends one or more string objects each appended with a line terminator (CR+LF) to the serial port/device. - Specified by:
- writelnin interface- SerialDataWriter
- Parameters:
- charset- The character set to use for encoding/decoding bytes to/from text characters
- data- One or more string objects (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writelnpublic void writeln(CharSequence... data) throws IllegalStateException, IOException Sends one or more ASCII string objects each appended with a line terminator (CR+LF) to the serial port/device. - Specified by:
- writelnin interface- SerialDataWriter
- Parameters:
- data- One or more ASCII string objects (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writelnpublic void writeln(Charset charset, Collection<? extends CharSequence> data) throws IllegalStateException, IOException Sends a collection of string objects each appended with a line terminator (CR+LF) to the serial port/device. - Specified by:
- writelnin interface- SerialDataWriter
- Parameters:
- charset- The character set to use for encoding/decoding bytes to/from text characters
- data- A collection of string objects (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 - 
writelnpublic void writeln(Collection<? extends CharSequence> data) throws IllegalStateException, IOException Sends a collection of ASCII string objects each appended with a line terminator (CR+LF) to the serial port/device. - Specified by:
- writelnin interface- SerialDataWriter
- Parameters:
- data- A collection of ASCII string objects (or an array) of data to be transmitted. (variable-length-argument)
- Throws:
- IllegalStateException
- IOException
 
 
- 
 
-