//==================================================================================================
// S t a n d a r d                                                                             Java
// O u t p u t T e x t F i l e
//                                                                                By Bruno Bachelet
//==================================================================================================
// Copyright (c) 1999-2016
// Bruno Bachelet - bruno@nawouak.net - http://www.nawouak.net
//
// This file is part of the B++ Library. This library is free software; you can redistribute it
// and/or modify it under the terms of the GNU Library General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU Library General Public License for more details (http://www.gnu.org).

/*DESCRIPTION*/
/* This module provides a class to manipulate output text files. */

// Package //---------------------------------------------------------------------------------------
package bpp.standard;

// Importation //-----------------------------------------------------------------------------------
import java.io.*;

// O u t p u t T e x t F i l e  Class //------------------------------------------------------------
/*CLASS OutputTextFile */ /* Represents an output text file. */
public class OutputTextFile extends OutputTextStream {
 //---------------------------------------------------------------------------------------Attributes
 protected PrintStream atStream;
 //--------------------------------------------------------------------------------------Constructor
 /*METHOD OutputTextFile */ /* Builds and opens an output text file. */
 public OutputTextFile(String agName) throws Exception {
  try { atStream=new PrintStream(new FileOutputStream(agName)); }
  catch (Exception e) { throw new Exception("Can't open the output file."); }
 }
 //----------------------------------------------------------------------------------------WriteLine
 /*METHOD OutputTextFile */ /* Terminates the line in the file. */
 public void writeLine() { atStream.println(); }
 //-----------------------------------------------------------------------------------Write (String)
 /*METHOD OutputTextFile */ /* Writes a string into the file. */
 public void write(String agString) { atStream.print(agString); }
 //-------------------------------------------------------------------------------WriteLine (String)
 /*METHOD OutputTextFile */ /* Writes a string and terminates the line in the file. */
 public void writeLine(String agString) { atStream.println(agString); }
 //----------------------------------------------------------------------------------Write (Integer)
 /*METHOD OutputTextFile */ /* Writes an integer into the file. */
 public void write(int agInteger) { atStream.print(agInteger); }
 //------------------------------------------------------------------------------WriteLine (Integer)
 /*METHOD OutputTextFile */ /* Writes an integer and terminates the line in the file. */
 public void writeLine(int agInteger) { atStream.println(agInteger); }
 //-------------------------------------------------------------------------------------Write (Real)
 /*METHOD OutputTextFile */ /* Writes a real number into the file. */
 public void write(double agReal) { atStream.print(agReal); }
 //---------------------------------------------------------------------------------WriteLine (Real)
 /*METHOD OutputTextFile */ /* Writes a real number and terminates the line in the file. */
 public void writeLine(double agReal) { atStream.println(agReal); }
}

// End //-------------------------------------------------------------------------------------------