public class org.iq.leveldb.impl.FileChannelLogWriter extends java.lang.Object implements org.iq.leveldb.impl.LogWriter
{
private final java.io.File file;
private final long fileNumber;
private final java.nio.channels.FileChannel fileChannel;
private final java.util.concurrent.atomic.AtomicBoolean closed;
private int blockOffset;
public void <init>(java.io.File, long) throws java.io.FileNotFoundException
{
java.io.FileOutputStream v;
java.util.concurrent.atomic.AtomicBoolean v;
long v;
java.io.File v;
byte v;
org.iq.leveldb.impl.FileChannelLogWriter v;
java.nio.channels.FileChannel v;
boolean v;
v := @this: org.iq.leveldb.impl.FileChannelLogWriter;
v := @parameter: java.io.File;
v := @parameter: long;
specialinvoke v.<java.lang.Object: void <init>()>();
v = new java.util.concurrent.atomic.AtomicBoolean;
specialinvoke v.<java.util.concurrent.atomic.AtomicBoolean: void <init>()>();
v.<org.iq.leveldb.impl.FileChannelLogWriter: java.util.concurrent.atomic.AtomicBoolean closed> = v;
staticinvoke <com.google.common.base.Preconditions: java.lang.Object checkNotNull(java.lang.Object,java.lang.Object)>(v, "file is null");
v = v cmp 0L;
if v < 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <com.google.common.base.Preconditions: void checkArgument(boolean,java.lang.Object)>(v, "fileNumber is negative");
v.<org.iq.leveldb.impl.FileChannelLogWriter: java.io.File file> = v;
v.<org.iq.leveldb.impl.FileChannelLogWriter: long fileNumber> = v;
v = new java.io.FileOutputStream;
specialinvoke v.<java.io.FileOutputStream: void <init>(java.io.File)>(v);
v = virtualinvoke v.<java.io.FileOutputStream: java.nio.channels.FileChannel getChannel()>();
v.<org.iq.leveldb.impl.FileChannelLogWriter: java.nio.channels.FileChannel fileChannel> = v;
return;
}
public boolean isClosed()
{
java.util.concurrent.atomic.AtomicBoolean v;
org.iq.leveldb.impl.FileChannelLogWriter v;
boolean v;
v := @this: org.iq.leveldb.impl.FileChannelLogWriter;
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.util.concurrent.atomic.AtomicBoolean closed>;
v = virtualinvoke v.<java.util.concurrent.atomic.AtomicBoolean: boolean get()>();
return v;
}
public synchronized void close()
{
java.util.concurrent.atomic.AtomicBoolean v;
java.io.IOException v;
org.iq.leveldb.impl.FileChannelLogWriter v;
java.nio.channels.FileChannel v, v;
v := @this: org.iq.leveldb.impl.FileChannelLogWriter;
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.util.concurrent.atomic.AtomicBoolean closed>;
virtualinvoke v.<java.util.concurrent.atomic.AtomicBoolean: void set(boolean)>(1);
label:
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.nio.channels.FileChannel fileChannel>;
virtualinvoke v.<java.nio.channels.FileChannel: void force(boolean)>(1);
label:
goto label;
label:
v := @caughtexception;
label:
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.nio.channels.FileChannel fileChannel>;
staticinvoke <org.iq.leveldb.util.Closeables: void closeQuietly(java.io.Closeable)>(v);
return;
catch java.io.IOException from label to label with label;
}
public synchronized void delete()
{
java.util.concurrent.atomic.AtomicBoolean v;
org.iq.leveldb.impl.FileChannelLogWriter v;
java.nio.channels.FileChannel v;
java.io.File v;
v := @this: org.iq.leveldb.impl.FileChannelLogWriter;
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.util.concurrent.atomic.AtomicBoolean closed>;
virtualinvoke v.<java.util.concurrent.atomic.AtomicBoolean: void set(boolean)>(1);
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.nio.channels.FileChannel fileChannel>;
staticinvoke <org.iq.leveldb.util.Closeables: void closeQuietly(java.io.Closeable)>(v);
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.io.File file>;
virtualinvoke v.<java.io.File: boolean delete()>();
return;
}
public java.io.File getFile()
{
org.iq.leveldb.impl.FileChannelLogWriter v;
java.io.File v;
v := @this: org.iq.leveldb.impl.FileChannelLogWriter;
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.io.File file>;
return v;
}
public long getFileNumber()
{
long v;
org.iq.leveldb.impl.FileChannelLogWriter v;
v := @this: org.iq.leveldb.impl.FileChannelLogWriter;
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: long fileNumber>;
return v;
}
public synchronized void addRecord(org.iq.leveldb.util.Slice, boolean) throws java.io.IOException
{
org.iq.leveldb.util.Slice v, v;
org.iq.leveldb.impl.LogChunkType v;
java.util.concurrent.atomic.AtomicBoolean v;
java.nio.ByteBuffer v;
org.iq.leveldb.util.SliceInput v;
int v, v, v, v, v, v, v, v;
org.iq.leveldb.impl.FileChannelLogWriter v;
boolean v, v, v, v, v, v, v, v;
java.nio.channels.FileChannel v, v;
v := @this: org.iq.leveldb.impl.FileChannelLogWriter;
v := @parameter: org.iq.leveldb.util.Slice;
v := @parameter: boolean;
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.util.concurrent.atomic.AtomicBoolean closed>;
v = virtualinvoke v.<java.util.concurrent.atomic.AtomicBoolean: boolean get()>();
if v != 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <com.google.common.base.Preconditions: void checkState(boolean,java.lang.Object)>(v, "Log has been closed");
v = virtualinvoke v.<org.iq.leveldb.util.Slice: org.iq.leveldb.util.SliceInput input()>();
v = 1;
label:
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: int blockOffset>;
v = (int) 32768;
v = v - v;
if v < 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <com.google.common.base.Preconditions: void checkState(boolean)>(v);
if v >= 7 goto label;
if v <= 0 goto label;
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.nio.channels.FileChannel fileChannel>;
v = staticinvoke <java.nio.ByteBuffer: java.nio.ByteBuffer allocate(int)>(v);
virtualinvoke v.<java.nio.channels.FileChannel: int write(java.nio.ByteBuffer)>(v);
label:
v.<org.iq.leveldb.impl.FileChannelLogWriter: int blockOffset> = 0;
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: int blockOffset>;
v = (int) 32768;
v = v - v;
label:
v = v - 7;
if v < 0 goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <com.google.common.base.Preconditions: void checkState(boolean)>(v);
v = virtualinvoke v.<org.iq.leveldb.util.SliceInput: int available()>();
if v <= v goto label;
v = 0;
v = v;
goto label;
label:
v = 1;
v = virtualinvoke v.<org.iq.leveldb.util.SliceInput: int available()>();
label:
if v == 0 goto label;
if v == 0 goto label;
v = <org.iq.leveldb.impl.LogChunkType: org.iq.leveldb.impl.LogChunkType FULL>;
goto label;
label:
if v == 0 goto label;
v = <org.iq.leveldb.impl.LogChunkType: org.iq.leveldb.impl.LogChunkType FIRST>;
goto label;
label:
if v == 0 goto label;
v = <org.iq.leveldb.impl.LogChunkType: org.iq.leveldb.impl.LogChunkType LAST>;
goto label;
label:
v = <org.iq.leveldb.impl.LogChunkType: org.iq.leveldb.impl.LogChunkType MIDDLE>;
label:
v = virtualinvoke v.<org.iq.leveldb.util.SliceInput: org.iq.leveldb.util.Slice readSlice(int)>(v);
specialinvoke v.<org.iq.leveldb.impl.FileChannelLogWriter: void writeChunk(org.iq.leveldb.impl.LogChunkType,org.iq.leveldb.util.Slice)>(v, v);
v = 0;
v = virtualinvoke v.<org.iq.leveldb.util.SliceInput: boolean isReadable()>();
if v != 0 goto label;
if v == 0 goto label;
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.nio.channels.FileChannel fileChannel>;
virtualinvoke v.<java.nio.channels.FileChannel: void force(boolean)>(0);
label:
return;
}
private void writeChunk(org.iq.leveldb.impl.LogChunkType, org.iq.leveldb.util.Slice) throws java.io.IOException
{
org.iq.leveldb.util.Slice v, v;
java.lang.Object[] v;
org.iq.leveldb.impl.LogChunkType v;
java.lang.Integer v;
int v, v, v, v, v, v, v, v, v, v, v, v, v;
org.iq.leveldb.impl.FileChannelLogWriter v;
boolean v, v;
java.nio.channels.FileChannel v, v;
v := @this: org.iq.leveldb.impl.FileChannelLogWriter;
v := @parameter: org.iq.leveldb.impl.LogChunkType;
v := @parameter: org.iq.leveldb.util.Slice;
v = virtualinvoke v.<org.iq.leveldb.util.Slice: int length()>();
v = (int) 65535;
if v > v goto label;
v = 1;
goto label;
label:
v = 0;
label:
v = newarray (java.lang.Object)[1];
v = virtualinvoke v.<org.iq.leveldb.util.Slice: int length()>();
v = staticinvoke <java.lang.Integer: java.lang.Integer valueOf(int)>(v);
v[0] = v;
staticinvoke <com.google.common.base.Preconditions: void checkArgument(boolean,java.lang.String,java.lang.Object[])>(v, "length %s is larger than two bytes", v);
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: int blockOffset>;
v = v + 7;
v = (int) 32768;
if v > v goto label;
v = 1;
goto label;
label:
v = 0;
label:
staticinvoke <com.google.common.base.Preconditions: void checkArgument(boolean)>(v);
v = virtualinvoke v.<org.iq.leveldb.util.Slice: int length()>();
v = specialinvoke v.<org.iq.leveldb.impl.FileChannelLogWriter: org.iq.leveldb.util.Slice newLogRecordHeader(org.iq.leveldb.impl.LogChunkType,org.iq.leveldb.util.Slice,int)>(v, v, v);
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.nio.channels.FileChannel fileChannel>;
v = virtualinvoke v.<org.iq.leveldb.util.Slice: int length()>();
virtualinvoke v.<org.iq.leveldb.util.Slice: int getBytes(int,java.nio.channels.GatheringByteChannel,int)>(0, v, v);
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: java.nio.channels.FileChannel fileChannel>;
v = virtualinvoke v.<org.iq.leveldb.util.Slice: int length()>();
virtualinvoke v.<org.iq.leveldb.util.Slice: int getBytes(int,java.nio.channels.GatheringByteChannel,int)>(0, v, v);
v = v.<org.iq.leveldb.impl.FileChannelLogWriter: int blockOffset>;
v = virtualinvoke v.<org.iq.leveldb.util.Slice: int length()>();
v = 7 + v;
v = v + v;
v.<org.iq.leveldb.impl.FileChannelLogWriter: int blockOffset> = v;
return;
}
private org.iq.leveldb.util.Slice newLogRecordHeader(org.iq.leveldb.impl.LogChunkType, org.iq.leveldb.util.Slice, int)
{
byte[] v;
org.iq.leveldb.util.Slice v, v, v;
org.iq.leveldb.impl.LogChunkType v;
org.iq.leveldb.util.SliceOutput v;
byte v, v, v;
int v, v, v, v;
org.iq.leveldb.impl.FileChannelLogWriter v;
v := @this: org.iq.leveldb.impl.FileChannelLogWriter;
v := @parameter: org.iq.leveldb.impl.LogChunkType;
v := @parameter: org.iq.leveldb.util.Slice;
v := @parameter: int;
v = virtualinvoke v.<org.iq.leveldb.impl.LogChunkType: int getPersistentId()>();
v = virtualinvoke v.<org.iq.leveldb.util.Slice: byte[] getRawArray()>();
v = virtualinvoke v.<org.iq.leveldb.util.Slice: int getRawOffset()>();
v = staticinvoke <org.iq.leveldb.impl.Logs: int getChunkChecksum(int,byte[],int,int)>(v, v, v, v);
v = staticinvoke <org.iq.leveldb.util.Slices: org.iq.leveldb.util.Slice allocate(int)>(7);
v = virtualinvoke v.<org.iq.leveldb.util.Slice: org.iq.leveldb.util.SliceOutput output()>();
virtualinvoke v.<org.iq.leveldb.util.SliceOutput: void writeInt(int)>(v);
virtualinvoke v.<org.iq.leveldb.util.SliceOutput: void writeByte(int)>(v);
virtualinvoke v.<org.iq.leveldb.util.SliceOutput: void writeByte(int)>(v);
virtualinvoke v.<org.iq.leveldb.impl.LogChunkType: int getPersistentId()>();
virtualinvoke v.<org.iq.leveldb.util.SliceOutput: void writeByte(int)>(v);
v = virtualinvoke v.<org.iq.leveldb.util.SliceOutput: org.iq.leveldb.util.Slice slice()>();
return v;
}
}