/**
* @author lautturi.com
* Java example: create an InputStream from string in java
*/
import java.util.*;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
public class Lautturi {
public static void main(String[] args) throws IOException {
String str = "Hello Lautturi Java";
InputStream targetStream = new ByteArrayInputStream(str.getBytes());
//Reads the 7th byte of data from the input stream.
targetStream.skip(6);
char ch = (char) targetStream.read();
System.out.println(ch);
targetStream.close();
}
}
output:
L