public class org.apache.axiom.attachments.impl.BufferUtils extends java.lang.Object
{
private static final org.apache.commons.logging.Log log;
public static final int BUFFER_LEN;
static boolean ENABLE_FILE_CHANNEL;
static boolean ENABLE_BAAOS_OPT;
private static byte[] _cacheBuffer;
private static boolean _cacheBufferInUse;
private static java.nio.ByteBuffer _cacheByteBuffer;
private static boolean _cacheByteBufferInUse;
public void <init>()
{
org.apache.axiom.attachments.impl.BufferUtils v;
v := @this: org.apache.axiom.attachments.impl.BufferUtils;
specialinvoke v.<java.lang.Object: void <init>()>();
return;
}
public static void inputStream2OutputStream(java.io.InputStream, java.io.OutputStream) throws java.io.IOException
{
java.io.OutputStream v;
java.lang.Throwable v;
byte[] v;
int v, v;
boolean v, v, v, v, v;
java.io.InputStream v;
v := @parameter: java.io.InputStream;
v := @parameter: java.io.OutputStream;
v = <org.apache.axiom.attachments.impl.BufferUtils: boolean ENABLE_FILE_CHANNEL>;
if v == 0 goto label;
v = v instanceof java.io.FileOutputStream;
if v == 0 goto label;
v = staticinvoke <org.apache.axiom.attachments.impl.BufferUtils: boolean inputStream2FileOutputStream(java.io.InputStream,java.io.FileOutputStream)>(v, v);
if v == 0 goto label;
return;
label:
v = <org.apache.axiom.attachments.impl.BufferUtils: boolean ENABLE_BAAOS_OPT>;
if v == 0 goto label;
v = v instanceof org.apache.axiom.ext.io.ReadFromSupport;
if v == 0 goto label;
interfaceinvoke v.<org.apache.axiom.ext.io.ReadFromSupport: long readFrom(java.io.InputStream,long)>(v, 9223372036854775807L);
return;
label:
v = staticinvoke <org.apache.axiom.attachments.impl.BufferUtils: byte[] getTempBuffer()>();
label:
v = virtualinvoke v.<java.io.InputStream: int read(byte[])>(v);
v = (int) -1;
if v == v goto label;
virtualinvoke v.<java.io.OutputStream: void write(byte[],int,int)>(v, 0, v);
goto label;
label:
staticinvoke <org.apache.axiom.attachments.impl.BufferUtils: void releaseTempBuffer(byte[])>(v);
goto label;
label:
v := @caughtexception;
staticinvoke <org.apache.axiom.attachments.impl.BufferUtils: void releaseTempBuffer(byte[])>(v);
throw v;
label:
return;
catch java.lang.Throwable from label to label with label;
}
public static int inputStream2OutputStream(java.io.InputStream, java.io.OutputStream, int) throws java.io.IOException
{
java.io.OutputStream v;
java.lang.Throwable v;
byte[] v;
long v;
int v, v, v, v, v, v;
boolean v, v;
java.io.InputStream v;
v := @parameter: java.io.InputStream;
v := @parameter: java.io.OutputStream;
v := @parameter: int;
v = <org.apache.axiom.attachments.impl.BufferUtils: boolean ENABLE_BAAOS_OPT>;
if v == 0 goto label;
v = v instanceof org.apache.axiom.ext.io.ReadFromSupport;
if v == 0 goto label;
v = interfaceinvoke v.<org.apache.axiom.ext.io.ReadFromSupport: long readFrom(java.io.InputStream,long)>(v, v);
return v;
label:
v = staticinvoke <org.apache.axiom.attachments.impl.BufferUtils: byte[] getTempBuffer()>();
v = 0;
label:
v = v - v;
if v <= 4096 goto label;
v = 4096;
goto label;
label:
v = v - v;
label:
v = virtualinvoke v.<java.io.InputStream: int read(byte[],int,int)>(v, 0, v);
if v <= 0 goto label;
virtualinvoke v.<java.io.OutputStream: void write(byte[],int,int)>(v, 0, v);
if v <= 0 goto label;
v = v + v;
label:
if v >= v goto label;
if v > 0 goto label;
v = virtualinvoke v.<java.io.InputStream: int available()>();
if v > 0 goto label;
label:
staticinvoke <org.apache.axiom.attachments.impl.BufferUtils: void releaseTempBuffer(byte[])>(v);
return v;
label:
v := @caughtexception;
staticinvoke <org.apache.axiom.attachments.impl.BufferUtils: void releaseTempBuffer(byte[])>(v);
throw v;
catch java.lang.Throwable from label to label with label;
}
public static boolean inputStream2FileOutputStream(java.io.InputStream, java.io.FileOutputStream) throws java.io.IOException
{
java.lang.Throwable v, v;
byte[] v, v, v;
java.io.FileOutputStream v;
java.nio.ByteBuffer v, v;
java.nio.channels.FileLock v;
int v, v;
java.nio.channels.FileChannel v;
boolean v;
java.io.InputStream v;
v := @parameter: java.io.InputStream;
v := @parameter: java.io.FileOutputStream;
v = null;
v = null;
v = null;
label:
v = virtualinvoke v.<java.io.FileOutputStream: java.nio.channels.FileChannel getChannel()>();
if v == null goto label;
v = virtualinvoke v.<java.nio.channels.FileChannel: java.nio.channels.FileLock tryLock()>();
label:
v = staticinvoke <org.apache.axiom.attachments.impl.BufferUtils: java.nio.ByteBuffer getTempByteBuffer()>();
label:
goto label;
label:
v := @caughtexception;
label:
if v == null goto label;
if v == null goto label;
v = virtualinvoke v.<java.nio.ByteBuffer: boolean hasArray()>();
if v != 0 goto label;
label:
staticinvoke <org.apache.axiom.attachments.impl.BufferUtils: void releaseTempByteBuffer(java.nio.ByteBuffer)>(v);
return 0;
label:
v = virtualinvoke v.<java.nio.ByteBuffer: byte[] array()>();
v = virtualinvoke v.<java.io.InputStream: int read(byte[])>(v);
label:
v = (int) -1;
if v == v goto label;
if v >= 4096 goto label;
v = staticinvoke <java.nio.ByteBuffer: java.nio.ByteBuffer allocate(int)>(v);
v = virtualinvoke v.<java.nio.ByteBuffer: byte[] array()>();
virtualinvoke v.<java.nio.ByteBuffer: java.nio.ByteBuffer put(byte[],int,int)>(v, 0, v);
virtualinvoke v.<java.nio.Buffer: java.nio.Buffer position(int)>(0);
virtualinvoke v.<java.nio.channels.FileChannel: int write(java.nio.ByteBuffer)>(v);
goto label;
label:
virtualinvoke v.<java.nio.Buffer: java.nio.Buffer position(int)>(0);
virtualinvoke v.<java.nio.channels.FileChannel: int write(java.nio.ByteBuffer)>(v);
virtualinvoke v.<java.nio.Buffer: java.nio.Buffer clear()>();
label:
v = virtualinvoke v.<java.nio.ByteBuffer: byte[] array()>();
v = virtualinvoke v.<java.io.InputStream: int read(byte[])>(v);
goto label;
label:
virtualinvoke v.<java.nio.channels.FileLock: void release()>();
staticinvoke <org.apache.axiom.attachments.impl.BufferUtils: void releaseTempByteBuffer(java.nio.ByteBuffer)>(v);
goto label;
label:
v := @caughtexception;
virtualinvoke v.<java.nio.channels.FileLock: void release()>();
staticinvoke <org.apache.axiom.attachments.impl.BufferUtils: void releaseTempByteBuffer(java.nio.ByteBuffer)>(v);
throw v;
label:
return 1;
catch java.lang.Throwable from label to label with label;
catch java.lang.Throwable from label to label with label;
}
public static long inputStream2BAAOutputStream(java.io.InputStream, org.apache.axiom.attachments.utils.BAAOutputStream, long) throws java.io.IOException
{
long v, v;
org.apache.axiom.attachments.utils.BAAOutputStream v;
java.io.InputStream v;
v := @parameter: java.io.InputStream;
v := @parameter: org.apache.axiom.attachments.utils.BAAOutputStream;
v := @parameter: long;
v = virtualinvoke v.<org.apache.axiom.attachments.utils.BAAOutputStream: long receive(java.io.InputStream,long)>(v, v);
return v;
}
public static int doesDataHandlerExceedLimit(javax.activation.DataHandler, int)
{
org.apache.axiom.attachments.impl.BufferUtils$SizeLimitExceededException v;
java.io.IOException v;
long v;
javax.activation.DataHandler v;
byte v, v, v;
int v, v, v;
javax.activation.DataSource v;
org.apache.commons.logging.Log v;
java.lang.String v;
org.apache.axiom.attachments.impl.BufferUtils$SizeLimitedOutputStream v;
v := @parameter: javax.activation.DataHandler;
v := @parameter: int;
if v != 0 goto label;
v = (int) -1;
return v;
label:
v = virtualinvoke v.<javax.activation.DataHandler: javax.activation.DataSource getDataSource()>();
v = staticinvoke <org.apache.axiom.util.activation.DataSourceUtils: long getSize(javax.activation.DataSource)>(v);
v = v cmp -1L;
if v == 0 goto label;
v = v cmp v;
if v <= 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
return v;
label:
v = new org.apache.axiom.attachments.impl.BufferUtils$SizeLimitedOutputStream;
specialinvoke v.<org.apache.axiom.attachments.impl.BufferUtils$SizeLimitedOutputStream: void <init>(int)>(v);
virtualinvoke v.<javax.activation.DataHandler: void writeTo(java.io.OutputStream)>(v);
label:
goto label;
label:
v := @caughtexception;
return 1;
label:
v := @caughtexception;
v = <org.apache.axiom.attachments.impl.BufferUtils: org.apache.commons.logging.Log log>;
v = virtualinvoke v.<java.io.IOException: java.lang.String getMessage()>();
interfaceinvoke v.<org.apache.commons.logging.Log: void warn(java.lang.Object)>(v);
v = (int) -1;
return v;
label:
return 0;
catch org.apache.axiom.attachments.impl.BufferUtils$SizeLimitExceededException from label to label with label;
catch java.io.IOException from label to label with label;
}
private static synchronized byte[] getTempBuffer()
{
java.lang.Throwable v;
byte[] v, v, v;
boolean v;
v = <org.apache.axiom.attachments.impl.BufferUtils: byte[] _cacheBuffer>;
entermonitor v;
label:
v = <org.apache.axiom.attachments.impl.BufferUtils: boolean _cacheBufferInUse>;
if v != 0 goto label;
<org.apache.axiom.attachments.impl.BufferUtils: boolean _cacheBufferInUse> = 1;
v = <org.apache.axiom.attachments.impl.BufferUtils: byte[] _cacheBuffer>;
exitmonitor v;
label:
return v;
label:
exitmonitor v;
label:
goto label;
label:
v := @caughtexception;
exitmonitor v;
throw v;
label:
v = newarray (byte)[4096];
return v;
catch java.lang.Throwable from label to label with label;
catch java.lang.Throwable from label to label with label;
}
private static void releaseTempBuffer(byte[])
{
java.lang.Throwable v;
byte[] v, v, v;
v := @parameter: byte[];
v = <org.apache.axiom.attachments.impl.BufferUtils: byte[] _cacheBuffer>;
entermonitor v;
label:
v = <org.apache.axiom.attachments.impl.BufferUtils: byte[] _cacheBuffer>;
if v != v goto label;
<org.apache.axiom.attachments.impl.BufferUtils: boolean _cacheBufferInUse> = 0;
label:
exitmonitor v;
label:
goto label;
label:
v := @caughtexception;
exitmonitor v;
throw v;
label:
return;
catch java.lang.Throwable from label to label with label;
}
private static synchronized java.nio.ByteBuffer getTempByteBuffer()
{
java.lang.Throwable v;
java.nio.ByteBuffer v, v, v;
boolean v;
v = <org.apache.axiom.attachments.impl.BufferUtils: java.nio.ByteBuffer _cacheByteBuffer>;
entermonitor v;
label:
v = <org.apache.axiom.attachments.impl.BufferUtils: boolean _cacheByteBufferInUse>;
if v != 0 goto label;
<org.apache.axiom.attachments.impl.BufferUtils: boolean _cacheByteBufferInUse> = 1;
v = <org.apache.axiom.attachments.impl.BufferUtils: java.nio.ByteBuffer _cacheByteBuffer>;
exitmonitor v;
label:
return v;
label:
exitmonitor v;
label:
goto label;
label:
v := @caughtexception;
exitmonitor v;
throw v;
label:
v = staticinvoke <java.nio.ByteBuffer: java.nio.ByteBuffer allocate(int)>(4096);
return v;
catch java.lang.Throwable from label to label with label;
catch java.lang.Throwable from label to label with label;
}
private static void releaseTempByteBuffer(java.nio.ByteBuffer)
{
java.lang.Throwable v;
java.nio.ByteBuffer v, v, v;
v := @parameter: java.nio.ByteBuffer;
v = <org.apache.axiom.attachments.impl.BufferUtils: java.nio.ByteBuffer _cacheByteBuffer>;
entermonitor v;
label:
v = <org.apache.axiom.attachments.impl.BufferUtils: java.nio.ByteBuffer _cacheByteBuffer>;
if v != v goto label;
<org.apache.axiom.attachments.impl.BufferUtils: boolean _cacheByteBufferInUse> = 0;
label:
exitmonitor v;
label:
goto label;
label:
v := @caughtexception;
exitmonitor v;
throw v;
label:
return;
catch java.lang.Throwable from label to label with label;
}
static void <clinit>()
{
byte[] v;
org.apache.commons.logging.Log v;
java.nio.ByteBuffer v;
v = staticinvoke <org.apache.commons.logging.LogFactory: org.apache.commons.logging.Log getLog(java.lang.Class)>(class "Lorg/apache/axiom/attachments/impl/BufferUtils;");
<org.apache.axiom.attachments.impl.BufferUtils: org.apache.commons.logging.Log log> = v;
<org.apache.axiom.attachments.impl.BufferUtils: boolean ENABLE_FILE_CHANNEL> = 1;
<org.apache.axiom.attachments.impl.BufferUtils: boolean ENABLE_BAAOS_OPT> = 1;
v = newarray (byte)[4096];
<org.apache.axiom.attachments.impl.BufferUtils: byte[] _cacheBuffer> = v;
<org.apache.axiom.attachments.impl.BufferUtils: boolean _cacheBufferInUse> = 0;
v = staticinvoke <java.nio.ByteBuffer: java.nio.ByteBuffer allocate(int)>(4096);
<org.apache.axiom.attachments.impl.BufferUtils: java.nio.ByteBuffer _cacheByteBuffer> = v;
<org.apache.axiom.attachments.impl.BufferUtils: boolean _cacheByteBufferInUse> = 0;
return;
}
}