📄 file.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: File.java
package jxl.read.biff;
import common.Logger;
import java.io.*;
import jxl.WorkbookSettings;
import jxl.biff.*;
// Referenced classes of package jxl.read.biff:
// BiffException, CompoundFile, Record
public class File
{
private static Logger logger;
private byte data[];
private int filePos;
private int oldPos;
private int initialFileSize;
private int arrayGrowSize;
private CompoundFile compoundFile;
private WorkbookSettings workbookSettings;
static Class class$jxl$read$biff$File; /* synthetic field */
public File(InputStream is, WorkbookSettings ws)
throws IOException, BiffException
{
workbookSettings = ws;
initialFileSize = workbookSettings.getInitialFileSize();
arrayGrowSize = workbookSettings.getArrayGrowSize();
byte d[] = new byte[initialFileSize];
int bytesRead = is.read(d);
int pos = bytesRead;
if(Thread.currentThread().isInterrupted())
throw new InterruptedIOException();
while(bytesRead != -1)
{
if(pos >= d.length)
{
byte newArray[] = new byte[d.length + arrayGrowSize];
System.arraycopy(d, 0, newArray, 0, d.length);
d = newArray;
}
bytesRead = is.read(d, pos, d.length - pos);
pos += bytesRead;
if(Thread.currentThread().isInterrupted())
throw new InterruptedIOException();
}
bytesRead = pos + 1;
if(bytesRead == 0)
throw new BiffException(BiffException.excelFileNotFound);
CompoundFile cf = new CompoundFile(d, ws);
try
{
data = cf.getStream("workbook");
}
catch(BiffException e)
{
data = cf.getStream("book");
}
if(!workbookSettings.getPropertySetsDisabled() && cf.getNumberOfPropertySets() > BaseCompoundFile.STANDARD_PROPERTY_SETS.length)
compoundFile = cf;
cf = null;
if(!workbookSettings.getGCDisabled())
System.gc();
}
public File(byte d[])
{
data = d;
}
Record next()
{
Record r = new Record(data, filePos, this);
return r;
}
Record peek()
{
int tempPos = filePos;
Record r = new Record(data, filePos, this);
filePos = tempPos;
return r;
}
public void skip(int bytes)
{
filePos += bytes;
}
public byte[] read(int pos, int length)
{
byte ret[] = new byte[length];
try
{
System.arraycopy(data, pos, ret, 0, length);
}
catch(ArrayIndexOutOfBoundsException e)
{
logger.error("Array index out of bounds at position " + pos + " record length " + length);
throw e;
}
return ret;
}
public int getPos()
{
return filePos;
}
public void setPos(int p)
{
oldPos = filePos;
filePos = p;
}
public void restorePos()
{
filePos = oldPos;
}
private void moveToFirstBof()
{
boolean bofFound = false;
while(!bofFound)
{
int code = IntegerHelper.getInt(data[filePos], data[filePos + 1]);
if(code == Type.BOF.value)
bofFound = true;
else
skip(128);
}
}
public void close()
{
}
public void clear()
{
data = null;
}
public boolean hasNext()
{
return filePos < data.length - 4;
}
CompoundFile getCompoundFile()
{
return compoundFile;
}
static Class class$(String x0)
{
return Class.forName(x0);
ClassNotFoundException x1;
x1;
throw new NoClassDefFoundError(x1.getMessage());
}
static
{
logger = Logger.getLogger(class$jxl$read$biff$File != null ? class$jxl$read$biff$File : (class$jxl$read$biff$File = class$("jxl.read.biff.File")));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -