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

no.ks.fiks.dokumentlager.klient.DokumentlagerPipedInputStream Maven / Gradle / Ivy

Go to download

Klient for opplasting, sletting og nedlasting av dokumenter fra Fiks Dokumentlager

The newest version!
package no.ks.fiks.dokumentlager.klient;

import java.io.IOException;
import java.io.PipedInputStream;

public class DokumentlagerPipedInputStream extends PipedInputStream {

    private volatile Exception exception = null;

    @Override
    public synchronized int read() throws IOException {
        int read = super.read();
        checkException();
        return read;
    }

    @Override
    public synchronized int read(byte[] bytes, int i, int i1) throws IOException {
        int read = super.read(bytes, i, i1);
        checkException();
        return read;
    }

    @Override
    public int read(byte[] bytes) throws IOException {
        int read = super.read(bytes);
        checkException();
        return read;
    }

    public void setException(Exception exception) {
        this.exception = exception;
    }

    private void checkException() throws IOException {
        if (exception != null) {
            throw new IOException(exception.getMessage(), exception);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy