0

I'm developing a system with Gemalto BG5ST (a java modem). I need to send a string sent via http GET request to the Serial Port. This string is stored, but the problem is that I need the data to be int or byte in order to write in the Outputstream.

Is there anyway to go around this?

OutputStream outStream = null;
  String strCOM = "comm:COM0;blocking=off;baudrate=115200";//autocts=off;autorts=off
  CommConnection commConn = (CommConnection)Connector.open(strCOM)
  inStream  = commConn.openInputStream();
  outStream = commConn.openOutputStream();

Working with IDE 1.3 due to modem restrictions. Thanks!

kohhworlwide
  • 45
  • 1
  • 9

2 Answers2

0

str.getBytes() - 1.1 version, used default charset

str.getBytes("UTF-8") - 1.1 version

rustot
  • 331
  • 1
  • 11
0

I did this to solve the issue.

byte[] data = v1.getBytes();
int j;
for (j=0;j<data.length;j++)
{
    outStream.write(data[j]);
    System.out.println(data[j]);
}

Thanks guys.

kohhworlwide
  • 45
  • 1
  • 9