org.netlib.util
Class EasyIn

java.lang.Object
  extended by org.netlib.util.EasyIn

public class EasyIn
extends java.lang.Object

Simple input from the keyboard for all primitive types. ver 1.0

Copyright (c) Peter van der Linden, May 5 1997. corrected error message 11/21/97

The creator of this software hereby gives you permission to:

  1. copy the work without changing it
  2. modify the work providing you send me a copy which I can use in any way I want, including incorporating into this work.
  3. distribute copies of the work to the public by sale, lease, rental, or lending
  4. perform the work
  5. display the work
  6. fold the work into a funny hat and wear it on your head.

This is not thread safe, not high performance, and doesn't tell EOF. It's intended for low-volume easy keyboard input. An example of use is:

EasyIn easy = new EasyIn();
int i = easy.readInt(); // reads an int from System.in
float f = easy.readFloat(); // reads a float from System.in

2/25/98 - modified by Keith Seymour to be useful with the f2j translator.

Author:
Peter van der Linden

Constructor Summary
EasyIn()
           
 
Method Summary
static void main(java.lang.String[] args)
          This method is just here to test the class
 boolean readboolean()
          Gets a boolean value from the next token.
 boolean readBoolean()
          Gets a boolean value from the next token.
 byte readbyte()
          Gets a byte value from the next token.
 byte readByte()
          Gets a byte value from the next token.
 char readchar()
          Gets a character value from the next token.
 char readChar()
          Gets a character value from the next token.
 java.lang.String readchars(int num_chars)
          Reads the specified number of characters and returns a new String containing them.
 java.lang.String readChars(int num_chars)
          Reads the specified number of characters and returns a new String containing them.
 double readdouble()
          Gets a double value from the next token.
 double readDouble()
          Gets a double value from the next token.
 float readfloat()
          Gets a float value from the next token.
 float readFloat()
          Gets a float value from the next token.
 int readint()
          Gets an integer value from the next token.
 int readInt()
          Gets an integer value from the next token.
 long readlong()
          Gets a long integer value from the next token.
 long readLong()
          Gets a long integer value from the next token.
 short readshort()
          Gets a short value from the next token.
 short readShort()
          Gets a short value from the next token.
 java.lang.String readstring()
          Gets a string value from the next token.
 java.lang.String readString()
          Gets a string value from the next token.
 void skipRemaining()
          Skips any tokens remaining on this line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EasyIn

public EasyIn()
Method Detail

readchars

public java.lang.String readchars(int num_chars)
                           throws java.io.IOException
Reads the specified number of characters and returns a new String containing them.

Parameters:
num_chars - the number of characters to read
Returns:
the String containing the characters read.
Throws:
java.io.IOException - if an input or output exception occurred.

readChars

public java.lang.String readChars(int num_chars)
Reads the specified number of characters and returns a new String containing them. Unlike readchars(), does not throw IOException.

Parameters:
num_chars - the number of characters to read
Returns:
the String containing the characters read.

skipRemaining

public void skipRemaining()
Skips any tokens remaining on this line.


readboolean

public boolean readboolean()
                    throws java.io.IOException
Gets a boolean value from the next token.

Returns:
the boolean value
Throws:
java.io.IOException - if an input or output exception occurred.

readBoolean

public boolean readBoolean()
Gets a boolean value from the next token. Same as readboolean() except it does not throw IOException.

Returns:
the boolean value

readbyte

public byte readbyte()
              throws java.io.IOException
Gets a byte value from the next token.

Returns:
the byte value
Throws:
java.io.IOException - if an input or output exception occurred.

readByte

public byte readByte()
Gets a byte value from the next token. Same as readbyte() except it does not throw IOException.

Returns:
the byte value

readshort

public short readshort()
                throws java.io.IOException
Gets a short value from the next token.

Returns:
the short value
Throws:
java.io.IOException - if an input or output exception occurred.

readShort

public short readShort()
Gets a short value from the next token. Same as readshort() except it does not throw IOException.

Returns:
the short value

readint

public int readint()
            throws java.io.IOException
Gets an integer value from the next token.

Returns:
the integer value
Throws:
java.io.IOException - if an input or output exception occurred.

readInt

public int readInt()
Gets an integer value from the next token. Same as readint() except it does not throw IOException.

Returns:
the integer value

readlong

public long readlong()
              throws java.io.IOException
Gets a long integer value from the next token.

Returns:
the long integer value
Throws:
java.io.IOException - if an input or output exception occurred.

readLong

public long readLong()
Gets a long integer value from the next token. Same as readlong() except it does not throw IOException.

Returns:
the long integer value

readfloat

public float readfloat()
                throws java.io.IOException
Gets a float value from the next token.

Returns:
the float value
Throws:
java.io.IOException - if an input or output exception occurred.

readFloat

public float readFloat()
Gets a float value from the next token. Same as readfloat() except it does not throw IOException.

Returns:
the float value

readdouble

public double readdouble()
                  throws java.io.IOException
Gets a double value from the next token.

Returns:
the double value
Throws:
java.io.IOException - if an input or output exception occurred.

readDouble

public double readDouble()
Gets a double value from the next token. Same as readdouble() except it does not throw IOException.

Returns:
the double value

readchar

public char readchar()
              throws java.io.IOException
Gets a character value from the next token.

Returns:
the character value
Throws:
java.io.IOException - if an input or output exception occurred.

readChar

public char readChar()
Gets a character value from the next token. Same as readchar() except it does not throw IOException.

Returns:
the character value

readstring

public java.lang.String readstring()
                            throws java.io.IOException
Gets a string value from the next token.

Returns:
the string value
Throws:
java.io.IOException - if an input or output exception occurred.

readString

public java.lang.String readString()
Gets a string value from the next token. Same as readstring() except it does not throw IOException.

Returns:
the string value

main

public static void main(java.lang.String[] args)
This method is just here to test the class