aspose file tools*
The moose likes I/O and Streams and the fly likes interpret stream data ---- URGENT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "interpret stream data ---- URGENT" Watch "interpret stream data ---- URGENT" New topic
Author

interpret stream data ---- URGENT

Roopa Joshi
Greenhorn

Joined: Sep 19, 2003
Posts: 6
I have a requirement in which i have to read the data sent by C prog as an array. The data is in structure format. How do i interpret the data.
Ex: The structure i send has int, float and bmp in it.
I will be receiving the stream on client side. How do i get the values.
i am using following code to read the int value from the first four bytes of the array.
(byte1&0x000000ff)|((byte2&0x000000ff)<<8)|((byte3&0x000000ff)<<16)|((byte4&0x000000ff)<<24)
Is this the only approach. Or is there any other better way of doing it ?
Pls help me soon...itz very urgent
Thanks in advance
Paul Frey
Greenhorn

Joined: Apr 25, 2002
Posts: 19
I think what you are looking for is available in Java 1.4's NIO api:
ScatteringByteChannel
You can read more about the NIO package at High-Performance I/O Arrives


Paul G. Frey, Jr.
 
Don't get me started about those stupid light bulbs.
 
subject: interpret stream data ---- URGENT