Microsoft Visual J++. Java



StreamDemo 2.2.

2.2. StreamDemo\StreamDemo.java

// =========================================================

//

//

// (C) ., 1997

//

// E-mail: frolov@glas.apc.org

// WWW: http://www.glasnet.ru/~frolov

//

// http://www.dials.ccas.ru/frolov

// =========================================================

import java.io.*;

public class StreamDemo

{

// -------------------------------------------------------

// main

// ,

// -------------------------------------------------------

public static void main(String args[])

{

//

DataOutputStream OutStream;

 

//

DataInputStream InStream;

 

//

byte bKbdInput[] = new byte[256];

 

// ,

String sOut;

 

//

//

try

{

//

System.out.println("Hello, Java!\n" +

"Enter string and press <Enter>...");

//

System.in.read(bKbdInput);

 

// String

sOut = new String(bKbdInput, 0);

}

catch(Exception ioe)

{

//

//

System.out.println(ioe.toString());

}

//

try

{

//

OutStream = new DataOutputStream(

new BufferedOutputStream(

new FileOutputStream("output.txt")));

 

// sOut

OutStream.writeBytes(sOut);