• 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

ByteArrayInputStream

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.io.*;

class ByteArrayInputStreamDemo {
public static void main(String args[])throws IOException {
String tmp="abdgdgddklldkhdldhk";
byte b[]=tmp.getBytes();
ByteArrayInputStream input1=new ByteArrayInputStream(b);
ByteArrayInputStream input2=new ByteArrayInputStream(b,0,3);
}
}

/************ now how do i retrieve the values stored in input1 and input2*******************/
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://java.sun.com/j2se/1.4.2/docs/api/java/io/ByteArrayInputStream.html

read

public int read()

Reads the next byte of data from this input stream.
-----
public int read(byte[] b,
int off,
int len)

Reads up to len bytes of data into an array of bytes from this input stream.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic