@@ -0,0 +1,2053 @@
+/*%0A *  $Id%0A *  IzPack%0A *  Copyright (C) 2001-2004 Julien Ponge%0A *%0A *  File :               ByteCountingOutputStream.java%0A *  Description :        Counts bytes that are written%0A *  Author's email :     julien@izforge.com%0A *  Author's Website :   http://www.izforge.com%0A *%0A *  Portions are Copyright (c) 2001 Johannes Lehtinen%0A *  johannes.lehtinen@iki.fi%0A *  http://www.iki.fi/jle/%0A *%0A *  Portions are Copyright (c) 2002 Paul Wilkinson%0A *  paulw@wilko.com%0A *%0A *  This program is free software; you can redistribute it and/or%0A *  modify it under the terms of the GNU General Public License%0A *  as published by the Free Software Foundation; either version 2%0A *  of the License, or any later version.%0A *%0A *  This program is distributed in the hope that it will be useful,%0A *  but WITHOUT ANY WARRANTY; without even the implied warranty of%0A *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A *  GNU General Public License for more details.%0A *%0A *  You should have received a copy of the GNU General Public License%0A *  along with this program; if not, write to the Free Software%0A *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.%0A */%0Apackage com.izforge.izpack.compiler;%0A%0Aimport java.io.OutputStream;%0Aimport java.io.IOException;%0A%0A/**%0A * Stream which countes the bytes written through it. Be sure to flush before%0A * checking size.%0A */%0Apublic class ByteCountingOutputStream extends OutputStream%0A%7B%0A  private long count;%0A  private OutputStream os;%0A%0A  public ByteCountingOutputStream(OutputStream os)%0A  %7B%0A    this.os = os;%0A  %7D%0A%0A  public void write(byte%5B%5D b, int off, int len) throws IOException%0A  %7B%0A    os.write(b, off, len);%0A    count += len;%0A  %7D%0A%0A  public void write(byte%5B%5D b) throws IOException%0A  %7B%0A    os.write(b);%0A    count += b.length;%0A  %7D%0A%0A  public void write(int b) throws IOException%0A  %7B%0A    os.write(b);%0A    count++;%0A  %7D%0A%0A  public void close() throws IOException%0A  %7B%0A    os.close();%0A  %7D%0A%0A  public void flush() throws IOException%0A  %7B%0A    os.flush();%0A  %7D%0A%0A  public long getByteCount()%0A  %7B%0A    return count;%0A  %7D%0A%7D%0A

separated out from Compiler