This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ByteArrayInputStream  RSS feed

 
pras
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • 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*******************/
 
Rajkishore Pujari
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!