Logo
Distributed Genetic Programming Framework
print print

File org.sfc.io.DefaultWriter.java

Here you can find all the information about the file org.sfc.io.DefaultWriter.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2005 Thomas Weise
 * 
 * E-Mail           : tweise@gmx.de
 * Creation Date    : 2005-06-22 16:25:35
 * Original Filename: org.sfc.io.ReferenceCountedWriter.java
 * Version          : 1.0.2
 * Last modification: 2006-03-07
 *                by: Thomas Weise
 * 
 * License          : GNU LESSER GENERAL PUBLIC LICENSE
 *                    Version 2.1, February 1999
 *                    You should have received a copy of this license along
 *                    with this library; if not, write to the Free Software
 *                    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *                    MA 02111-1307, USA or download the license under
 *                    http://www.gnu.org/copyleft/lesser.html.
 *                    
 * Warranty         : This software is provided "as is" without any
 *                    warranty; without even the implied warranty of
 *                    merchantability or fitness for a particular purpose.
 *                    See the Gnu Lesser General Public License for more
 *                    details.
 */

 
package org.sfc.io;

import java.io.IOException;
import java.io.Writer;

/**
 * This class is a wrapper for <code>Writer</code>s that makes them
 * reference counted.
 * @author Thomas Weise 
 */

class DefaultWriter extends  ReferenceCountedWriter
  { 
/**
 * The internal writer.
 */

  private final Writer m_out;
    
/**
 * Create a reference counted <code>Writer</code>.
 * 
 * @param p_original  The underlying object.
 */

  DefaultWriter  (final  Writer p_original)
    {
    super();
    this.m_out = p_original;
    }
    
/**
 * Return the name of the character encoding being used by this stream.
 *
 * <p> If the encoding has an historical name then that name is returned;
 * otherwise the encoding's canonical name is returned.
 *
 * <p> If this instance was created with the  constructor then the returned
 * name, being unique for the encoding, may differ from the name passed to
 * the constructor.  This method may return <tt>null</tt> if the stream has
 * been closed. </p>
 *
 * @return The historical name of this encoding, or possibly
 *         <code>null</code> if the stream has been closed
 */

  @Override
  public  final String  get_encoding  ()
    {        
    return default_get_encoding(this.m_out);
    }
  
  

/**
 * Dispose this reference counted writer.
 * @throws  IOException If the underlying was closed and caused an
 *                      IOException.
 */

  @Override
  protected final void  dispose () throws IOException
    {
    try
      {
      this.m_out.close();
      }
    finally
      {
      super.dispose();
      }
    }
  
/**
 * Write a single character.
 * @param p_c The character to be written.
 * @exception  IOException  If an I/O error occurs
 */

  @Override
  public        void write(final  int p_c) throws IOException
    {
    this.m_out.write(p_c);
    }

/**
 * Write a portion of an array of characters.
 *
 * @param  p_cbuf  Buffer of characters to be written
 * @param  p_off   Offset from which to start reading characters
 * @param  p_len   Number of characters to be written
 *
 * @exception  IOException  If an I/O error occurs
 */

  @Override
  public        void write(final  char[]  p_cbuf,
                           final  int     p_off,
                           final  int     p_len) throws IOException
    {
    this.m_out.write(p_cbuf, p_off, p_len);
    }

/**
 * Write a portion of a string.
 *
 * @param  p_str  String to be written
 * @param  p_off  Offset from which to start reading characters
 * @param  p_len  Number of characters to be written
 *
 * @exception  IOException  If an I/O error occurs
 */

  @Override
  public        void write(final  String  p_str,
                           final  int     p_off,
                           final  int     p_len) throws IOException
    {
    this.m_out.write(p_str, p_off, p_len);
    }

/**
 * Flush the stream.
 *
 * @exception  IOException  If an I/O error occurs
 */

  @Override
  public final  void flush() throws IOException
    {
    this.m_out.flush();
    }
  }

File Information:

file name:DefaultWriter.java
package:org.sfc.io
qualified name:org.sfc.io.DefaultWriter.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/sfc/io/DefaultWriter.java
size:4.156 KB (4256 B)
uploaded: 2015-07-22 04:11:12 GMT+0000
last update: 2006-03-07 04:20:28 GMT+0000
last access: 2018-01-24 01:27:08 GMT+0000

statistics online since 2006-01-02.   RSS Feed
Contact us by sending an email to tweise@gmx.de to receive further information, to report errors, or to join our project.
All content on this site (http://dgpf.sourceforge.net/) is LGPL-licensed.
http://dgpf.sourceforge.net/scripts/source/source.php last modified at 2015-07-22 04:10:53 GMT+0000 served at 2018-01-24 01:27:08 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo