• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to use ByteArrayInputStream?

 
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
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?
regards,
Arun
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To The I/O and Streams Forum...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic