Microsoft Visual J++. Java


- 2


new BufferedInputStream(

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

 

//

TokenizerOfStream tos = new TokenizerOfStream();

 

//

tos.TokenizeIt(InStream);

 

//

InStream.close();

 

System.out.println("Press <Enter> to terminate...");

System.in.read(bKbdInput);

}

catch(Exception ioe)

{

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

}

}

}

 

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

// TokenizerOfStream

//

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

class TokenizerOfStream

{

public void TokenizeIt(InputStream is)

{

//

StreamTokenizer stok;

 

//

String str;

 

try

{

//

stok = new StreamTokenizer(is);

 

// ,

// ++ ( '/')

stok.slashSlashComments(true);

 

// , '.'

stok.ordinaryChar('.');

 

// ,

//

//

while(stok.nextToken() != StreamTokenizer.TT_EOF)

{

//

switch(stok.ttype)

{

// ,

//

case StreamTokenizer.TT_WORD:

{

str = new String("\nTT_WORD >" + stok.sval);

break;

}

 

// ,

//

case StreamTokenizer.TT_NUMBER:

{

str = "\nTT_NUMBER >" +

Double.toString(stok.nval);