📄 supbookrecord.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: SupbookRecord.java
package jxl.write.biff;
import common.Assert;
import common.Logger;
import jxl.WorkbookSettings;
import jxl.biff.EncodedURLHelper;
import jxl.biff.IntegerHelper;
import jxl.biff.StringHelper;
import jxl.biff.Type;
import jxl.biff.WritableRecordData;
class SupbookRecord extends WritableRecordData
{
private static class SupbookType
{
private SupbookType()
{
}
SupbookType(_cls1 x0)
{
this();
}
}
private static Logger logger;
private SupbookType type;
private byte data[];
private int numSheets;
private String fileName;
private String sheetNames[];
private WorkbookSettings workbookSettings;
public static final SupbookType INTERNAL = new SupbookType(null);
public static final SupbookType EXTERNAL = new SupbookType(null);
public static final SupbookType ADDIN = new SupbookType(null);
public static final SupbookType LINK = new SupbookType(null);
public static final SupbookType UNKNOWN = new SupbookType(null);
static Class class$jxl$write$biff$SupbookRecord; /* synthetic field */
public SupbookRecord()
{
super(Type.SUPBOOK);
type = ADDIN;
try
{
throw new Exception();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public SupbookRecord(int sheets, WorkbookSettings ws)
{
super(Type.SUPBOOK);
numSheets = sheets;
type = INTERNAL;
workbookSettings = ws;
}
public SupbookRecord(String fn, WorkbookSettings ws)
{
super(Type.SUPBOOK);
fileName = fn;
numSheets = 1;
sheetNames = new String[0];
workbookSettings = ws;
type = EXTERNAL;
}
public SupbookRecord(jxl.read.biff.SupbookRecord sr, WorkbookSettings ws)
{
super(Type.SUPBOOK);
workbookSettings = ws;
jxl.read.biff.SupbookRecord _tmp = sr;
if(sr.getType() == jxl.read.biff.SupbookRecord.INTERNAL)
{
type = INTERNAL;
numSheets = sr.getNumberOfSheets();
} else
{
jxl.read.biff.SupbookRecord _tmp1 = sr;
if(sr.getType() == jxl.read.biff.SupbookRecord.EXTERNAL)
{
type = EXTERNAL;
numSheets = sr.getNumberOfSheets();
fileName = sr.getFileName();
sheetNames = new String[numSheets];
for(int i = 0; i < numSheets; i++)
sheetNames[i] = sr.getSheetName(i);
}
}
jxl.read.biff.SupbookRecord _tmp2 = sr;
if(sr.getType() == jxl.read.biff.SupbookRecord.ADDIN)
logger.warn("Supbook type is addin");
}
private void initInternal(jxl.read.biff.SupbookRecord sr)
{
numSheets = sr.getNumberOfSheets();
initInternal();
}
private void initInternal()
{
data = new byte[4];
IntegerHelper.getTwoBytes(numSheets, data, 0);
data[2] = 1;
data[3] = 4;
type = INTERNAL;
}
void adjustInternal(int sheets)
{
Assert.verify(type == INTERNAL);
numSheets = sheets;
initInternal();
}
private void initExternal()
{
int totalSheetNameLength = 0;
for(int i = 0; i < numSheets; i++)
totalSheetNameLength += sheetNames[i].length();
byte fileNameData[] = EncodedURLHelper.getEncodedURL(fileName, workbookSettings);
int dataLength = 6 + fileNameData.length + numSheets * 3 + totalSheetNameLength * 2;
data = new byte[dataLength];
IntegerHelper.getTwoBytes(numSheets, data, 0);
int pos = 2;
IntegerHelper.getTwoBytes(fileNameData.length + 1, data, pos);
data[pos + 2] = 0;
data[pos + 3] = 1;
System.arraycopy(fileNameData, 0, data, pos + 4, fileNameData.length);
pos += 4 + fileNameData.length;
for(int i = 0; i < sheetNames.length; i++)
{
IntegerHelper.getTwoBytes(sheetNames[i].length(), data, pos);
data[pos + 2] = 1;
StringHelper.getUnicodeBytes(sheetNames[i], data, pos + 3);
pos += 3 + sheetNames[i].length() * 2;
}
}
private void initAddin()
{
data = (new byte[] {
1, 0, 1, 58
});
}
public byte[] getData()
{
if(type == INTERNAL)
initInternal();
else
if(type == EXTERNAL)
initExternal();
else
if(type == ADDIN)
{
initAddin();
} else
{
logger.warn("unsupported supbook type - defaulting to internal");
initInternal();
}
return data;
}
public SupbookType getType()
{
return type;
}
public int getNumberOfSheets()
{
return numSheets;
}
public String getFileName()
{
return fileName;
}
public int getSheetIndex(String s)
{
boolean found = false;
int sheetIndex = 0;
for(int i = 0; i < sheetNames.length && !found; i++)
if(sheetNames[i].equals(s))
{
found = true;
sheetIndex = 0;
}
if(found)
{
return sheetIndex;
} else
{
String names[] = new String[sheetNames.length + 1];
names[sheetNames.length] = s;
sheetNames = names;
return sheetNames.length - 1;
}
}
public String getSheetName(int s)
{
return sheetNames[s];
}
static Class class$(String x0)
{
return Class.forName(x0);
ClassNotFoundException x1;
x1;
throw new NoClassDefFoundError(x1.getMessage());
}
static
{
logger = Logger.getLogger(class$jxl$write$biff$SupbookRecord != null ? class$jxl$write$biff$SupbookRecord : (class$jxl$write$biff$SupbookRecord = class$("jxl.write.biff.SupbookRecord")));
}
// Unreferenced inner classes:
/* anonymous class */
static class _cls1
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -