java string to InputStream

java string to InputStream
refer ‮tual:ot‬turi.com
/**
 * @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
Created Time:2017-09-22 08:05:16  Author:lautturi