How to write ASCII in the OutputStream

According to the Datamax Documentation:

<CR> is used to identify the line termination character. Other strings placed
between < > in this manual represent the character of the same ASCII name, and
are single-byte hexadecimal values (e.g., <STX>, <CR>, and <0x0D> equal 02, 0D,
and 0D, respectively). 

I was trying to write the code < CR> in the Printer OutputStream but I dont know how? I tried the following code:

outputStream.write("<CR>");

But it didnt worked. How do I write ASCII and Hexadecimal in the outputstream?

Jon Skeet
people
quotationmark

Here, <CR> means "carriage-return", i.e. "\r". However, if you've got an OutputStream and you want to write text to it, I would suggest wrapping it in an OutputStreamWriter, specifying the appropriate encoding. You can then use text-oriented calls appropriately.

For other values, you can use \uxxxx, e.g. \u0002 for STX.

people

See more on this question at Stackoverflow