/*
 * Copyright (c) 2004-2017, by Alex Leigh.
 * All rights reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 */

package lc.mecha.io;

import java.io.IOException;
import java.io.OutputStream;

public final class ByteCountingOutputStream extends OutputStream {
    private long size;

    /**
     * @see java.io.OutputStream#write(int)
     */
    public void write(int b) throws IOException {
        size++;
    }

    /**
     * @see java.io.OutputStream#write(byte[], int, int)
     */
    public void write(byte b[], int off, int len) throws IOException {
        size += len;
    }

    /**
     * @return Number of bytes written to this stream
     */
    public long size() {
        return size;
    }
}