All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.nuiton.eugene.MonitorWriter Maven / Gradle / Ivy

/* *##% 
 * EUGene :: EUGene
 * Copyright (C) 2004 - 2009 CodeLutin
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program 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 General Lesser Public License for more details.
 *
 * You should have received a copy of the GNU General Lesser Public
 * License along with this program.  If not, see
 * .
 * ##%*/

package org.nuiton.eugene;

import java.io.FilterWriter;
import java.io.IOException;
import java.io.StringWriter;

/**
 * Permet de savoir si on a ecrit dans le flux ou non. L'ecriture d'une chaine
 * vide a le meme comportement que l'ecriture d'une vrai chaine.
 * De cette façon meme les fichiers peuvent être créer.
 * 
 * Created: Jun 8, 2004
 *
 * @author Benjamin Poussin 
 * Copyright Code Lutin
 * @version $Revision: 755 $
 *
 * Mise a jour: $Date: 2009-12-15 00:50:27 +0100 (mar., 15 déc. 2009) $
 * par : $Author: tchemit $
 */
public class MonitorWriter extends FilterWriter { // MonitorWriter

    boolean modified = false;
    //FIXME : ca sert a quoi duplique cette propriete qui existe dans FilterWriter ?
    StringWriter out = null;

    public MonitorWriter(StringWriter out) {
        super(out);
        this.out = out;
    }

    public StringBuffer getBuffer() {
        return out.getBuffer();
    }

    public boolean isModified() {
        return modified;
    }

    @Override
    public void write(int c) throws IOException {
        super.write(c);
        modified = true;
    }

    @Override
    public void write(char[] cbuf, int off, int len) throws IOException {
        super.write(cbuf, off, len);
        modified = true;
    }

    @Override
    public void write(String str, int off, int len) throws IOException {
        super.write(str, off, len);
        modified = true;
    }

}// MonitorWriter





© 2015 - 2025 Weber Informatics LLC | Privacy Policy