public class org.apache.activemq.transport.nio.NIOOutputStream extends java.io.OutputStream implements org.apache.activemq.transport.tcp.TimeStampStream
{
private static final int BUFFER_SIZE;
private final java.nio.channels.WritableByteChannel out;
private final byte[] buffer;
private final java.nio.ByteBuffer byteBuffer;
private int count;
private boolean closed;
private volatile long writeTimestamp;
private javax.net.ssl.SSLEngine engine;
public void <init>(java.nio.channels.WritableByteChannel)
{
java.nio.channels.WritableByteChannel v;
org.apache.activemq.transport.nio.NIOOutputStream v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
v := @parameter: java.nio.channels.WritableByteChannel;
specialinvoke v.<org.apache.activemq.transport.nio.NIOOutputStream: void <init>(java.nio.channels.WritableByteChannel,int)>(v, 8196);
return;
}
public void <init>(java.nio.channels.WritableByteChannel, int)
{
byte[] v, v;
org.apache.activemq.transport.nio.NIOOutputStream v;
int v;
java.nio.channels.WritableByteChannel v;
java.lang.IllegalArgumentException v;
java.nio.ByteBuffer v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
v := @parameter: java.nio.channels.WritableByteChannel;
v := @parameter: int;
specialinvoke v.<java.io.OutputStream: void <init>()>();
v.<org.apache.activemq.transport.nio.NIOOutputStream: long writeTimestamp> = -1L;
v.<org.apache.activemq.transport.nio.NIOOutputStream: java.nio.channels.WritableByteChannel out> = v;
if v > 0 goto label;
v = new java.lang.IllegalArgumentException;
specialinvoke v.<java.lang.IllegalArgumentException: void <init>(java.lang.String)>("Buffer size <= 0");
throw v;
label:
v = newarray (byte)[v];
v.<org.apache.activemq.transport.nio.NIOOutputStream: byte[] buffer> = v;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: byte[] buffer>;
v = staticinvoke <java.nio.ByteBuffer: java.nio.ByteBuffer wrap(byte[])>(v);
v.<org.apache.activemq.transport.nio.NIOOutputStream: java.nio.ByteBuffer byteBuffer> = v;
return;
}
public void write(int) throws java.io.IOException
{
byte[] v;
org.apache.activemq.transport.nio.NIOOutputStream v;
int v, v, v, v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
v := @parameter: int;
virtualinvoke v.<org.apache.activemq.transport.nio.NIOOutputStream: void checkClosed()>();
v = specialinvoke v.<org.apache.activemq.transport.nio.NIOOutputStream: int availableBufferToWrite()>();
if v >= 1 goto label;
virtualinvoke v.<org.apache.activemq.transport.nio.NIOOutputStream: void flush()>();
label:
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: byte[] buffer>;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: int count>;
v = v + 1;
v.<org.apache.activemq.transport.nio.NIOOutputStream: int count> = v;
v[v] = v;
return;
}
public void write(byte[], int, int) throws java.io.IOException
{
byte[] v, v, v;
java.nio.ByteBuffer v;
org.apache.activemq.transport.nio.NIOOutputStream v;
int v, v, v, v, v, v, v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
v := @parameter: byte[];
v := @parameter: int;
v := @parameter: int;
virtualinvoke v.<org.apache.activemq.transport.nio.NIOOutputStream: void checkClosed()>();
v = specialinvoke v.<org.apache.activemq.transport.nio.NIOOutputStream: int availableBufferToWrite()>();
if v >= v goto label;
virtualinvoke v.<org.apache.activemq.transport.nio.NIOOutputStream: void flush()>();
label:
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: byte[] buffer>;
v = lengthof v;
if v < v goto label;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: byte[] buffer>;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: int count>;
staticinvoke <java.lang.System: void arraycopy(java.lang.Object,int,java.lang.Object,int,int)>(v, v, v, v, v);
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: int count>;
v = v + v;
v.<org.apache.activemq.transport.nio.NIOOutputStream: int count> = v;
goto label;
label:
v = staticinvoke <java.nio.ByteBuffer: java.nio.ByteBuffer wrap(byte[],int,int)>(v, v, v);
virtualinvoke v.<org.apache.activemq.transport.nio.NIOOutputStream: void write(java.nio.ByteBuffer)>(v);
label:
return;
}
public void flush() throws java.io.IOException
{
org.apache.activemq.transport.nio.NIOOutputStream v;
int v, v;
java.nio.channels.WritableByteChannel v;
java.nio.ByteBuffer v, v, v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: int count>;
if v <= 0 goto label;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: java.nio.channels.WritableByteChannel out>;
if v == null goto label;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: java.nio.ByteBuffer byteBuffer>;
virtualinvoke v.<java.nio.ByteBuffer: java.nio.ByteBuffer position(int)>(0);
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: java.nio.ByteBuffer byteBuffer>;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: int count>;
virtualinvoke v.<java.nio.ByteBuffer: java.nio.ByteBuffer limit(int)>(v);
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: java.nio.ByteBuffer byteBuffer>;
virtualinvoke v.<org.apache.activemq.transport.nio.NIOOutputStream: void write(java.nio.ByteBuffer)>(v);
v.<org.apache.activemq.transport.nio.NIOOutputStream: int count> = 0;
label:
return;
}
public void close() throws java.io.IOException
{
org.apache.activemq.transport.nio.NIOOutputStream v;
javax.net.ssl.SSLEngine v, v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
specialinvoke v.<java.io.OutputStream: void close()>();
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: javax.net.ssl.SSLEngine engine>;
if v == null goto label;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: javax.net.ssl.SSLEngine engine>;
virtualinvoke v.<javax.net.ssl.SSLEngine: void closeOutbound()>();
label:
v.<org.apache.activemq.transport.nio.NIOOutputStream: boolean closed> = 1;
return;
}
protected void checkClosed() throws java.io.IOException
{
org.apache.activemq.transport.nio.NIOOutputStream v;
java.io.EOFException v;
boolean v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: boolean closed>;
if v == 0 goto label;
v = new java.io.EOFException;
specialinvoke v.<java.io.EOFException: void <init>(java.lang.String)>("Cannot write to the stream any more it has already been closed");
throw v;
label:
return;
}
private int availableBufferToWrite()
{
byte[] v;
org.apache.activemq.transport.nio.NIOOutputStream v;
int v, v, v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: byte[] buffer>;
v = lengthof v;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: int count>;
v = v - v;
return v;
}
protected void write(java.nio.ByteBuffer) throws java.io.IOException
{
java.lang.Throwable v;
long v, v;
java.io.InterruptedIOException v;
java.nio.ByteBuffer v, v;
javax.net.ssl.SSLEngine v, v, v, v, v;
javax.net.ssl.SSLSession v;
byte v;
int v, v, v, v;
boolean v, v;
org.apache.activemq.transport.nio.NIOOutputStream v;
java.lang.InterruptedException v;
java.nio.channels.WritableByteChannel v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
v := @parameter: java.nio.ByteBuffer;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: javax.net.ssl.SSLEngine engine>;
if v == null goto label;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: javax.net.ssl.SSLEngine engine>;
v = virtualinvoke v.<javax.net.ssl.SSLEngine: javax.net.ssl.SSLSession getSession()>();
v = interfaceinvoke v.<javax.net.ssl.SSLSession: int getPacketBufferSize()>();
v = staticinvoke <java.nio.ByteBuffer: java.nio.ByteBuffer allocate(int)>(v);
virtualinvoke v.<java.nio.ByteBuffer: java.nio.ByteBuffer clear()>();
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: javax.net.ssl.SSLEngine engine>;
virtualinvoke v.<javax.net.ssl.SSLEngine: javax.net.ssl.SSLEngineResult wrap(java.nio.ByteBuffer,java.nio.ByteBuffer)>(v, v);
virtualinvoke v.<java.nio.ByteBuffer: java.nio.ByteBuffer flip()>();
goto label;
label:
v = v;
label:
v = virtualinvoke v.<java.nio.ByteBuffer: int remaining()>();
v = 1L;
v = (int) -1;
v = v;
label:
v = staticinvoke <java.lang.System: long currentTimeMillis()>();
v.<org.apache.activemq.transport.nio.NIOOutputStream: long writeTimestamp> = v;
label:
if v <= 0 goto label;
if v != 0 goto label;
label:
staticinvoke <java.lang.Thread: void sleep(long)>(v);
v = v * 2L;
v = v cmp 1000L;
if v <= 0 goto label;
v = 1000L;
label:
goto label;
label:
v := @caughtexception;
v = new java.io.InterruptedIOException;
specialinvoke v.<java.io.InterruptedIOException: void <init>()>();
throw v;
label:
v = 1L;
label:
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: java.nio.channels.WritableByteChannel out>;
v = interfaceinvoke v.<java.nio.channels.WritableByteChannel: int write(java.nio.ByteBuffer)>(v);
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: javax.net.ssl.SSLEngine engine>;
if v == null goto label;
v = virtualinvoke v.<java.nio.ByteBuffer: boolean hasRemaining()>();
if v == 0 goto label;
v = virtualinvoke v.<java.nio.ByteBuffer: boolean hasRemaining()>();
if v != 0 goto label;
virtualinvoke v.<java.nio.ByteBuffer: java.nio.ByteBuffer clear()>();
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: javax.net.ssl.SSLEngine engine>;
virtualinvoke v.<javax.net.ssl.SSLEngine: javax.net.ssl.SSLEngineResult wrap(java.nio.ByteBuffer,java.nio.ByteBuffer)>(v, v);
virtualinvoke v.<java.nio.ByteBuffer: java.nio.ByteBuffer flip()>();
label:
v = virtualinvoke v.<java.nio.ByteBuffer: int remaining()>();
goto label;
label:
v.<org.apache.activemq.transport.nio.NIOOutputStream: long writeTimestamp> = -1L;
goto label;
label:
v := @caughtexception;
v.<org.apache.activemq.transport.nio.NIOOutputStream: long writeTimestamp> = -1L;
throw v;
label:
return;
catch java.lang.InterruptedException from label to label with label;
catch java.lang.Throwable from label to label with label;
}
public boolean isWriting()
{
org.apache.activemq.transport.nio.NIOOutputStream v;
byte v;
long v;
boolean v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: long writeTimestamp>;
v = v cmp 0L;
if v <= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
return v;
}
public long getWriteTimestamp()
{
long v;
org.apache.activemq.transport.nio.NIOOutputStream v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
v = v.<org.apache.activemq.transport.nio.NIOOutputStream: long writeTimestamp>;
return v;
}
public void setEngine(javax.net.ssl.SSLEngine)
{
org.apache.activemq.transport.nio.NIOOutputStream v;
javax.net.ssl.SSLEngine v;
v := @this: org.apache.activemq.transport.nio.NIOOutputStream;
v := @parameter: javax.net.ssl.SSLEngine;
v.<org.apache.activemq.transport.nio.NIOOutputStream: javax.net.ssl.SSLEngine engine> = v;
return;
}
}