info1
Class TextOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byinfo1.TextOutputStream

public class TextOutputStream
extends java.io.OutputStream


Constructor Summary
TextOutputStream(java.lang.String s)
          Constructs a text output stream that sends its output to a file
 
Method Summary
 void close()
          Closes the stream
 boolean fail()
          Tests if the output stream is no longer valid
 void print(char c)
          Prints a character to a stream
 void print(double x)
          Prints a double precision floating point number to a stream
 void print(long l)
          Prints a long integer to a stream
 void print(java.lang.Object o)
          Prints an object to a stream.
 void print(java.lang.String s)
          Prints a string to a stream
 void printf(java.lang.String fmt, char x)
          Prints a character to a stream, with formatting instructions
 void printf(java.lang.String fmt, double x)
          Prints a double precision floating point number to a stream, with formatting instructions
 void printf(java.lang.String fmt, long x)
          Prints a long integer to a stream, with formatting instructions
 void printf(java.lang.String fmt, java.lang.String x)
          Prints a string to a stream, with formatting instructions
 void println()
          Prints a newline
 void println(char c)
          Prints a character to a stream, followed by a newline
 void println(double x)
          Prints a double precision floating point number to a stream, followed by a newline
 void println(long l)
          Prints a long integer to a stream, followed by a newline
 void println(java.lang.Object o)
          Prints an object to a stream, followed by a newline.
 void println(java.lang.String s)
          Prints a string to a stream, followed by a newline
 void write(int b)
          Writes one byte to the stream
 
Methods inherited from class java.io.OutputStream
flush, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextOutputStream

public TextOutputStream(java.lang.String s)
Constructs a text output stream that sends its output to a file

Parameters:
s - the file name
Method Detail

fail

public boolean fail()
Tests if the output stream is no longer valid

Returns:
true if the stream has failed

close

public void close()
Closes the stream


write

public void write(int b)
Writes one byte to the stream

Parameters:
b - the byte to write

print

public void print(java.lang.String s)
Prints a string to a stream

Parameters:
s - the string to print

print

public void print(char c)
Prints a character to a stream

Parameters:
c - the character to print

print

public void print(java.lang.Object o)
Prints an object to a stream. The toString method of the object is invoked

Parameters:
o - the object to print

print

public void print(long l)
Prints a long integer to a stream

Parameters:
l - the number to print

print

public void print(double x)
Prints a double precision floating point number to a stream


println

public void println(java.lang.String s)
Prints a string to a stream, followed by a newline

Parameters:
s - the string to print

println

public void println(char c)
Prints a character to a stream, followed by a newline

Parameters:
c - the character to print

println

public void println(java.lang.Object o)
Prints an object to a stream, followed by a newline. The toString method of the object is invoked

Parameters:
o - the object to print

println

public void println(long l)
Prints a long integer to a stream, followed by a newline

Parameters:
l - the number to print

println

public void println(double x)
Prints a double precision floating point number to a stream, followed by a newline


println

public void println()
Prints a newline


printf

public void printf(java.lang.String fmt,
                   double x)
Prints a double precision floating point number to a stream, with formatting instructions

Parameters:
fmt - the formatting instruction string. The string has a prefix, a format code and a suffix. The prefix and suffix become part of the formatted output. The format code directs the formatting of the parameter to be formatted. The code has the following structure
  • a % (required)
  • a modifier (optional)
    +
    forces display of + for positive numbers
    0
    show leading zeroes
    -
    align left in the field
    space
    prepend a space in front of positive numbers
    #
    use "alternate" format: Don't suppress trailing zeroes in general floating point format.
  • an integer denoting field width (optional)
  • a period followed by an integer denoting precision (optional)
  • a format descriptor (required)
    f
    floating point number in fixed format
    e, E
    floating point number in exponential notation (scientific format). The E format results in an uppercase E for the exponent (1.14130E+003), the e format in a lowercase e.
    g, G
    floating point number in general format (fixed format for small numbers, exponential format for large numbers). Trailing zeroes are suppressed. The G format results in an uppercase E for the exponent (if any), the g format in a lowercase e.

printf

public void printf(java.lang.String fmt,
                   long x)
Prints a long integer to a stream, with formatting instructions

Parameters:
fmt - the formatting instruction string. The string has a prefix, a format code and a suffix. The prefix and suffix become part of the formatted output. The format code directs the formatting of the parameter to be formatted. The code has the following structure
  • a % (required)
  • a modifier (optional)
    +
    forces display of + for positive numbers
    0
    show leading zeroes
    -
    align left in the field
    space
    prepend a space in front of positive numbers
    #
    use "alternate" format: Add 0 or 0x for octal or hexadecimal numbers.
  • an integer denoting field width (optional)
  • a format descriptor (required)
    d, i
    integer in decimal
    x
    integer in hexadecimal
    o
    integer in octal
x - the number to print

printf

public void printf(java.lang.String fmt,
                   char x)
Prints a character to a stream, with formatting instructions

Parameters:
fmt - the formatting instruction string. The string has a prefix, a format code and a suffix. The prefix and suffix become part of the formatted output. The format code directs the formatting of the parameter to be formatted. The code has the following structure
  • a % (required)
  • a modifier (optional)
    +
    forces display of + for positive numbers
    0
    show leading zeroes
    -
    align left in the field
    space
    prepend a space in front of positive numbers
    #
    use "alternate" format: Add 0 or 0x for octal or hexadecimal numbers.
  • an integer denoting field width (optional)
  • a format descriptor (required)
    d, i
    integer in decimal
    x
    integer in hexadecimal
    o
    integer in octal
    c
    character
x - the character to print

printf

public void printf(java.lang.String fmt,
                   java.lang.String x)
Prints a string to a stream, with formatting instructions

Parameters:
fmt - the formatting instruction string. The string has a prefix, a format code and a suffix. The prefix and suffix become part of the formatted output. The format code directs the formatting of the parameter to be formatted. The code has the following structure
  • a % (required)
  • a modifier (optional)
    -
    align left in the field
  • an integer denoting field width (optional)
  • a format descriptor (required)
    s
    string
x - the character to print