O'Reilly logo

EJB 3.1 Cookbook by Richard M. Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling a byte-based message

Sometimes it is necessary to send an unformatted stream of bytes as a message. This recipe illustrates this process using the BytesMessage interface. However, when possible, other message types such as string and objects should be used.

The advantages of using an unformatted stream of bytes include ease of read and write operations and a fixed size message. When data is written or read using the BytesMessage methods, it is stored using the appropriate primitive data format. For example, when an integer is written, it will be stored as a 32-bit two's complement number. The size of the number will always be four bytes regardless of the number of digits comprising the number.

Getting ready

The essential structure of a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required