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

org.subethamail.smtp.internal.io.BetterByteArrayOutputStream Maven / Gradle / Ivy

Go to download

A fork of a fork (!) of SubEtha, an easy-to-use server-side SMTP library for Java.

There is a newer version: 7.1.3
Show newest version
package org.subethamail.smtp.internal.io;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;

/**
 * Adds a getInputStream() method which does not need to make a copy of the
 * underlying array.
 */
final class BetterByteArrayOutputStream extends ByteArrayOutputStream {
    BetterByteArrayOutputStream() {
    }

    BetterByteArrayOutputStream(int size) {
        super(size);
    }

    /**
     * Does not make a copy of the internal buffer.
     */
    InputStream getInputStream() {
        return new ByteArrayInputStream(this.buf, 0, this.count);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy