Package totalcross.io

Class DataStreamLE

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class DataStreamLE
    extends DataStream
    DataStreamLE can be attached to any Stream such as a PortConnector, PDBFile, or ByteArrayStream, which lets you read and write standard Java data types like int, double, and String in a simple manner. Here's an example:
     PortConnector port = new PortConnector(9600, 0);
     DataStream ds = new DataStream(port);
     ds.writeString("Hello");
     int status = ds.readUnsignedByte();
     if (status == 1)
     {
        ds.writeString("Pi");
        ds.writeDouble(3.14);
     }
     port.close();
     

    Important!: All methods read and write numeric data in the little endian format (Intel format). For more information, see this.
    See Also:
    DataStream