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

📄 escherrecord.java

📁 一个非常有用的操作MCRSOFT EXCEL文件的工具。可以用JAVA方便的新建
💻 JAVA
字号:
/*********************************************************************
*
*      Copyright (C) 2003 Andrew Khan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/

package jxl.biff.drawing;

/**
 * The base class for all escher records.  This class contains
 * the common header data and is basically a wrapper for the EscherRecordData
 * object
 */
abstract class EscherRecord
{
  /**
   * The escher data
   */
  //  private EscherRecordData data;
  protected EscherRecordData data;

  /**
   * The length of the escher header on all records
   */
  protected final static int HEADER_LENGTH = 8;

  /**
   * Constructor
   *
   * @param erd the data
   */
  protected EscherRecord(EscherRecordData erd)
  {
    data = erd;
  }

  /**
   * Constructor
   *
   * @param type the type
   */
  protected EscherRecord(EscherRecordType type)
  {
    data = new EscherRecordData(type);
  }

  /**
   * Identifies whether this item is a container
   *
   * @param cont TRUE if this is a container, FALSE otherwise
   */
  protected void setContainer(boolean cont)
  {
    data.setContainer(cont);
  }

  /**
   * Gets the entire length of the record, including the header
   *
   * @return the length of the record, including the header data
   */
  public int getLength()
  {
    return data.getLength() + HEADER_LENGTH;
  }

  /**
   * Accessor for the escher stream 
   *
   * @return the escher stream
   */
  protected final EscherStream getEscherStream()
  {
    return data.getEscherStream();
  }

  /**
   * The position of this escher record in the stream
   *
   * @return the position
   */
  protected final int getPos()
  {
    return data.getPos();
  }

  /**
   * Accessor for the instance
   *
   * @return the instance
   */
  protected final int getInstance()
  {
    return data.getInstance();
  }

  /**
   * Sets the instance number when writing out the escher data
   *
   * @param i the instance
   */
  protected final void setInstance(int i)
  {
    data.setInstance(i);
  }

  /**
   * Sets the version when writing out the escher data
   *
   * @param v the version
   */
  protected final void setVersion (int v)
  {
    data.setVersion(v);
  }

  /**
   * Accessor for the escher type
   *
   * @return the type
   */
  public EscherRecordType getType()
  {
    return data.getType();
  }

  /**
   * Abstract method used to retrieve the generated escher data when writing
   * out image information
   *
   * @return the escher data
   */
  abstract byte[] getData();

  /**
   * Prepends the standard header data to the first eight bytes of the array
   * and returns it
   */
  final byte[] setHeaderData(byte[] d)
  {
    return data.setHeaderData(d);
  }

  /**
   * Gets the data that was read in, excluding the header data
   *
   * @return the bytes read in, excluding the header data
   */
  byte[] getBytes()
  {
    return data.getBytes();
  }

  /**
   * Accessor for the stream length
   *
   * @return the stream length
   */
  protected int getStreamLength()
  {
    return data.getStreamLength();
  }
}

⌨️ 快捷键说明

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