wood burning stoves
The moose likes Beginning Java and the fly likes how to use ByteArrayInputStream? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to use ByteArrayInputStream?" Watch "how to use ByteArrayInputStream?" New topic

how to use ByteArrayInputStream?

arun mahajan
Ranch Hand

Joined: Dec 07, 2001
Posts: 305
I am getting input / send output thru socket.... how can i use ByteArrayInputStream and ByteArrayOutputStream to get the input data from socket??? how can i combine a stream of data to be send to socket using ByteArrayInputStream and ByteArrayOutputStream ???
See the problem is that if I use other Streams and their read method has one problem it blocks the stream till it:
1. either gets some bytes
2. or gets some exeption
though my objective is to get immediate information wheather their is some data available their or not? I was thinking of using ByteArrayInputStream Read method and will try to read first byte to see if it is -1 or not..but could able to understand how to use it...or is their any other way out..
Can you please help me?
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
To The I/O and Streams Forum...
I agree. Here's the link: http://aspose.com/file-tools
subject: how to use ByteArrayInputStream?
It's not a secret anymore!