SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
. . . and you can see what a wonderful output you get from that. You will notice, however, that bf is ¿ not inverted L. I couldn't find inverted L in Unicode; they must call it something different.java CharacterPrinter 43 61 6d 70 62 65 6c 6c 20 bf
Jesper de Jong wrote:
Is cmd2Device a string?
If you want to write a byte with the value 0xBF to the output stream, then don't use text-based methods like the print method from class PrintStream. Note that class OutputStream has methods to send bytes. Sending a byte with the value 0xBF is very easy:
Alan Blass wrote:Hi Jesper, yes, cmd2Device is a string. I cannot use out.write because out.write requires a byte. I have a string. What should I do?
Jesper de Jong wrote:
Alan Blass wrote:Hi Jesper, yes, cmd2Device is a string. I cannot use out.write because out.write requires a byte. I have a string. What should I do?
What character do you have in cmd2Device that should lead to a byte 0xBF being sent?
Jesper de Jong wrote:When you want to send bytes, then why are you converting those bytes to chars first? That leads to all the unnecessary hassle with character encodings. Why not send the bytes directly?
Jesper de Jong wrote:
Alan: You don't have to put the whole command in a string at once and then send that thing. You can just send the bytes of the different parts separately. For example:
Alan Blass wrote:Why is cmd2Device.getBytes() is used? If my cmd2Device has a character that is greater than 0x7F, it will be cut off. For example, I have 0xBF, I cannot use .getBytes() because I will get a different value.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Consider Paul's rocket mass heater. |