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

org.broadinstitute.hellbender.utils.runtime.StreamOutput Maven / Gradle / Ivy

There is a newer version: 4.6.0.0
Show newest version
package org.broadinstitute.hellbender.utils.runtime;

/**
 * The content of stdout or stderr.
 */
public abstract class StreamOutput {
    /**
     * Empty stream output when no output is captured due to an error.
     */
    public static final StreamOutput EMPTY = new StreamOutput() {
        @Override
        public byte[] getBufferBytes() {
            return new byte[0];
        }

        @Override
        public boolean isBufferTruncated() {
            return false;
        }
    };

    /**
     * Returns the content as a string.
     *
     * @return The content as a string.
     */
    public String getBufferString() {
        return new String(getBufferBytes());
    }

    /**
     * Returns the content as a string.
     *
     * @return The content as a string.
     */
    public abstract byte[] getBufferBytes();

    /**
     * Returns true if the buffer was truncated.
     *
     * @return true if the buffer was truncated.
     */
    public abstract boolean isBufferTruncated();

    @Override
    public String toString(){
        return getBufferString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy