Search code examples
javamodemat-command

Gettind well-readable answer form modem (AT)


I'm Java programmer. I try to get answer from my dial-up modem Acorp. Send AT-commands and see, that modem work correctly. I read answer using InputStream and I get this: [B@127734f What is it? Why modem did'n send "OK"???. Thanks


Solution

  • It may well have done - but it looks like you're just calling toString() on a byte array. Don't do that - if you want to convert the contents of a byte array to text, use a String constructor. For example:

    String text = new String(data, 0, bytesRead, "US-ASCII");