⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 supbookrecord.java

📁 实现JAVA界面的代码GWT
💻 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.read.biff;

import common.Logger;
import jxl.WorkbookSettings;
import jxl.biff.*;

// Referenced classes of package jxl.read.biff:
//            Record

public class SupbookRecord extends RecordData
{
    private static class Type
    {

        private Type()
        {
        }

        Type(_cls1 x0)
        {
            this();
        }
    }


    private static Logger logger;
    private Type type;
    private int numSheets;
    private String fileName;
    private String sheetNames[];
    public static final Type INTERNAL = new Type(null);
    public static final Type EXTERNAL = new Type(null);
    public static final Type ADDIN = new Type(null);
    public static final Type LINK = new Type(null);
    public static final Type UNKNOWN = new Type(null);
    static Class class$jxl$read$biff$SupbookRecord; /* synthetic field */

    SupbookRecord(Record t, WorkbookSettings ws)
    {
        super(t);
        byte data[] = getRecord().getData();
        if(data.length == 4)
        {
            if(data[2] == 1 && data[3] == 4)
                type = INTERNAL;
            else
            if(data[2] == 1 && data[3] == 58)
                type = ADDIN;
            else
                type = UNKNOWN;
        } else
        if(data[0] == 0 && data[1] == 0)
            type = LINK;
        else
            type = EXTERNAL;
        if(type == INTERNAL)
            numSheets = IntegerHelper.getInt(data[0], data[1]);
        if(type == EXTERNAL)
            readExternal(data, ws);
    }

    private void readExternal(byte data[], WorkbookSettings ws)
    {
        numSheets = IntegerHelper.getInt(data[0], data[1]);
        int ln = IntegerHelper.getInt(data[2], data[3]) - 1;
        int pos = 0;
        if(data[4] == 0)
        {
            int encoding = data[5];
            pos = 6;
            if(encoding == 0)
            {
                fileName = StringHelper.getString(data, ln, pos, ws);
                pos += ln;
            } else
            {
                fileName = getEncodedFilename(data, ln, pos);
                pos += ln;
            }
        } else
        {
            int encoding = IntegerHelper.getInt(data[5], data[6]);
            pos = 7;
            if(encoding == 0)
            {
                fileName = StringHelper.getUnicodeString(data, ln, pos);
                pos += ln * 2;
            } else
            {
                fileName = getUnicodeEncodedFilename(data, ln, pos);
                pos += ln * 2;
            }
        }
        sheetNames = new String[numSheets];
        for(int i = 0; i < sheetNames.length; i++)
        {
            ln = IntegerHelper.getInt(data[pos], data[pos + 1]);
            if(data[pos + 2] == 0)
            {
                sheetNames[i] = StringHelper.getString(data, ln, pos + 3, ws);
                pos += ln + 3;
                continue;
            }
            if(data[pos + 2] == 1)
            {
                sheetNames[i] = StringHelper.getUnicodeString(data, ln, pos + 3);
                pos += ln * 2 + 3;
            }
        }

    }

    public Type getType()
    {
        return type;
    }

    public int getNumberOfSheets()
    {
        return numSheets;
    }

    public String getFileName()
    {
        return fileName;
    }

    public String getSheetName(int i)
    {
        return sheetNames[i];
    }

    public byte[] getData()
    {
        return getRecord().getData();
    }

    private String getEncodedFilename(byte data[], int ln, int pos)
    {
        StringBuffer buf = new StringBuffer();
        for(int endpos = pos + ln; pos < endpos; pos++)
        {
            char c = (char)data[pos];
            if(c == '\001')
            {
                pos++;
                c = (char)data[pos];
                buf.append(c);
                buf.append(":\\\\");
                continue;
            }
            if(c == '\002')
            {
                buf.append('\\');
                continue;
            }
            if(c == '\003')
            {
                buf.append('\\');
                continue;
            }
            if(c == '\004')
                buf.append("..\\");
            else
                buf.append(c);
        }

        return buf.toString();
    }

    private String getUnicodeEncodedFilename(byte data[], int ln, int pos)
    {
        StringBuffer buf = new StringBuffer();
        for(int endpos = pos + ln * 2; pos < endpos; pos += 2)
        {
            char c = (char)IntegerHelper.getInt(data[pos], data[pos + 1]);
            if(c == '\001')
            {
                pos += 2;
                c = (char)IntegerHelper.getInt(data[pos], data[pos + 1]);
                buf.append(c);
                buf.append(":\\\\");
                continue;
            }
            if(c == '\002')
            {
                buf.append('\\');
                continue;
            }
            if(c == '\003')
            {
                buf.append('\\');
                continue;
            }
            if(c == '\004')
                buf.append("..\\");
            else
                buf.append(c);
        }

        return buf.toString();
    }

    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$SupbookRecord != null ? class$jxl$read$biff$SupbookRecord : (class$jxl$read$biff$SupbookRecord = class$("jxl.read.biff.SupbookRecord")));
    }

// Unreferenced inner classes:

/* anonymous class */
    static class _cls1
    {
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -