Package totalcross.io.device.bluetooth
Class SerialPortClient
- java.lang.Object
-
- totalcross.io.Stream
-
- totalcross.io.device.bluetooth.SerialPortClient
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class SerialPortClient extends Stream
-
-
Field Summary
-
Fields inherited from class totalcross.io.Stream
skipBuffer
-
-
Constructor Summary
Constructors Constructor Description SerialPortClient(java.lang.String address, int port, java.lang.String[] params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this I/O connection, releasing any associated resources.protected voidfinalize()intreadBytes(byte[] buf, int start, int count)Reads bytes from the stream.intwriteBytes(byte[] buf, int start, int count)Writes bytes to the stream.-
Methods inherited from class totalcross.io.Stream
asInputStream, asOutputStream, asStream, asStream, skipBytes, wrapInputStream, wrapInputStreamToStream, write, writeBytes, writeBytes, writeBytes
-
-
-
-
Constructor Detail
-
SerialPortClient
public SerialPortClient(java.lang.String address, int port, java.lang.String[] params) throws IOException- Throws:
IOException
-
-
Method Detail
-
readBytes
public int readBytes(byte[] buf, int start, int count) throws IOExceptionDescription copied from class:StreamReads bytes from the stream. Returns the number of bytes actually read or -1 if the end of the stream was reached. (if applicable to the stream)- Specified by:
readBytesin classStream- Parameters:
buf- the byte array to read data intostart- the start position in the arraycount- the number of bytes to read- Throws:
IOException
-
writeBytes
public int writeBytes(byte[] buf, int start, int count) throws IOExceptionDescription copied from class:StreamWrites bytes to the stream. Returns the number of bytes actually written or throws anIOExceptionif an error prevented the write operation from occurring.- Specified by:
writeBytesin classStream- Parameters:
buf- the byte array to write data fromstart- the start position in the byte arraycount- the number of bytes to write- Returns:
- the number of bytes actually written
- Throws:
IOException
-
close
public void close() throws IOExceptionCloses this I/O connection, releasing any associated resources. Once closed a connection is no longer valid.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
IOException- If an I/O error occurs.
-
finalize
protected void finalize()
- Overrides:
finalizein classjava.lang.Object
-
-