Thursday, August 4, 2011

Try Streams


package com.evs.objava33.class10;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

public class TryStream {

// BufferredInputStream = Memory Buffer
// DataINputStream = Primitive Data Types Read / Write
// CheckedInputStreamjj = Checksum maintenance
// CiperInputSteam = ENcypt- decyrtion
// DigestInputStream = One way encryption
// InflatorINputStream = Compression (91-97%), Image (4-9%), Video (1-3%).
// LineNUmberINputStream = Read Data and keep track of line#
// ProgressMonitorInputStream = Keep track of progress
// PushBackInputStream = Send it to designated resource

public static void main(String[] args) {
// BufferedInputStream in = new BufferedInputStream(System.in);
// try {
// byte[] b = new byte[100];
// int readBytes = in.read(b);
// String str = new String(b, 0, readBytes);
// System.out.println(str);
// } catch (IOException e) {
// e.printStackTrace();
// }

BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
try {
char[] b = new char[100];
int readBytes = reader.read(b);
String str = new String(b, 0, readBytes);
System.out.println(str);
} catch (IOException e) {
e.printStackTrace();
}

}
}

No comments:

Post a Comment