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 stream-based message

Sometimes it is desirable to send a stream of primitive values as a message. This recipe illustrates this process using the StreamMessage interface.

The advantages of using a stream of bytes are essentially the same as those for the BytesMessage: ease of read and write operations and a fixed size message. Data is written or read by storing the data in primitive format. In addition, information about the type of data written is also stored. This means that if an integer is written then only a corresponding integer read operation can be used against the data.

The StreamMessage interface differs from the BytesMessage in that data stored using StreamMessage interface incorporates information about the data type. This ...

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