package org.jboss.resteasy.util;
import java.io.IOException;
import java.util.concurrent.CompletionStage;
import org.jboss.resteasy.spi.AsyncOutputStream;
public class extends AsyncOutputStream
{
protected AsyncOutputStream ;
protected boolean ;
protected CommitHeaderOutputStream.CommitCallback ;
public (final AsyncOutputStream delegate, final CommitHeaderOutputStream.CommitCallback headers)
{
this.delegate = delegate;
this.headers = headers;
}
public ()
{
}
public AsyncOutputStream ()
{
return delegate;
}
public void (AsyncOutputStream delegate)
{
this.delegate = delegate;
}
public void (CommitHeaderOutputStream.CommitCallback headers)
{
this.headers = headers;
}
public synchronized void ()
{
if (isHeadersCommitted) return;
isHeadersCommitted = true;
headers.commit();
}
@Override
public void (int i) throws IOException
{
commit();
delegate.write(i);
}
@Override
public void (byte[] bytes) throws IOException
{
commit();
delegate.write(bytes);
}
@Override
public void (byte[] bytes, int i, int i1) throws IOException
{
commit();
delegate.write(bytes, i, i1);
}
@Override
public void () throws IOException
{
commit();
delegate.flush();
}
@Override
public void () throws IOException
{
commit();
delegate.close();
}
@Override
public CompletionStage<Void> ()
{
commit();
return delegate.asyncFlush();
}
@Override
public CompletionStage<Void> (byte[] bytes, int offset, int length)
{
commit();
return delegate.asyncWrite(bytes, offset, length);
}
}