org.apache.poi.hssf.record.Record.serialize()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(197)

本文整理了Java中org.apache.poi.hssf.record.Record.serialize方法的一些代码示例,展示了Record.serialize的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Record.serialize方法的具体详情如下:
包路径:org.apache.poi.hssf.record.Record
类名称:Record
方法名:serialize

Record.serialize介绍

[英]called by the class that is responsible for writing this sucker. Subclasses should implement this so that their data is passed back in a byte array.
[中]由负责写这本书的类调用。子类应该实现这一点,以便它们的数据以字节数组的形式传回。

代码示例

代码示例来源:origin: org.apache.poi/poi

public int serialize(int offset, byte[] data) {
    int result = 0;
    for (Record rec : _list) {
      result += rec.serialize(offset + result, data);
    }
    return result;
  }
}

代码示例来源:origin: org.apache.poi/poi

public void visitRecord(Record r) {
    int currentOffset = _startOffset + _countBytesWritten;
    _countBytesWritten += r.serialize(currentOffset, _data);
  }
}

代码示例来源:origin: org.apache.poi/poi

/**
 * called by the class that is responsible for writing this sucker.
 * Subclasses should implement this so that their data is passed back in a
 * byte array.
 *
 * @return byte array containing instance data
 */
public final byte[] serialize() {
  byte[] retval = new byte[ getRecordSize() ];
  serialize(0, retval);
  return retval;
}

代码示例来源:origin: org.apache.poi/poi

/**
   * Clone the current record, via a call to serialize
   *  it, and another to create a new record from the
   *  bytes.
   * May only be used for classes which don't have
   *  internal counts / ids in them. For those which
   *  do, a full model-aware cloning is needed, which
   *  allocates new ids / counts as needed.
   * 
   * @return the cloned current record
   */
  public Record cloneViaReserialise() {
    // Do it via a re-serialization
    // It's a cheat, but it works...
    byte[] b = serialize();
    RecordInputStream rinp = new RecordInputStream(new ByteArrayInputStream(b));
    rinp.nextRecord();

    Record[] r = RecordFactory.createRecord(rinp);
    if(r.length != 1) {
      throw new IllegalStateException("Re-serialised a record to clone it, but got " + r.length + " records back!");
    }
    return r[0];
  }
}

代码示例来源:origin: org.apache.poi/poi

pos += obj.serialize(pos, data);

代码示例来源:origin: org.apache.poi/poi

len = record.serialize( pos + offset, data );

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

public void visitRecord(Record r) {
    int currentOffset = _startOffset + _countBytesWritten;
    _countBytesWritten += r.serialize(currentOffset, _data);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

public int serialize(int offset, byte[] data) {
    int result = 0;
    for (Record rec : _list) {
      result += rec.serialize(offset + result, data);
    }
    return result;
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

public void visitRecord(Record r) {
    int currentOffset = _startOffset + _countBytesWritten;
    _countBytesWritten += r.serialize(currentOffset, _data);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/poi

public void visitRecord(Record r) {
    int currentOffset = _startOffset + _countBytesWritten;
    _countBytesWritten += r.serialize(currentOffset, _data);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/poi

public int serialize(int offset, byte[] data) {
    int result = 0;
    int nRecs = _list.size();
    for(int i=0; i<nRecs; i++) {
      Record rec = (Record)_list.get(i);
      result += rec.serialize(offset + result, data);
    }
    return result;
  }
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

public int serialize(int offset, byte[] data) {
    int result = 0;
    int nRecs = _list.size();
    for(int i=0; i<nRecs; i++) {
      Record rec = (Record)_list.get(i);
      result += rec.serialize(offset + result, data);
    }
    return result;
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * called by the class that is responsible for writing this sucker.
 * Subclasses should implement this so that their data is passed back in a
 * byte array.
 *
 * @return byte array containing instance data
 */
public final byte[] serialize() {
  byte[] retval = new byte[ getRecordSize() ];
  serialize(0, retval);
  return retval;
}

代码示例来源:origin: com.haulmont.thirdparty/poi

/**
 * called by the class that is responsible for writing this sucker.
 * Subclasses should implement this so that their data is passed back in a
 * byte array.
 *
 * @return byte array containing instance data
 */
public final byte[] serialize() {
  byte[] retval = new byte[ getRecordSize() ];
  serialize(0, retval);
  return retval;
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * called by the class that is responsible for writing this sucker.
 * Subclasses should implement this so that their data is passed back in a
 * byte array.
 *
 * @return byte array containing instance data
 */
public final byte[] serialize() {
  byte[] retval = new byte[ getRecordSize() ];
  serialize(0, retval);
  return retval;
}

代码示例来源:origin: com.haulmont.thirdparty/poi

/**
   * Clone the current record, via a call to serialize
   *  it, and another to create a new record from the
   *  bytes.
   * May only be used for classes which don't have
   *  internal counts / ids in them. For those which
   *  do, a full model-aware cloning is needed, which
   *  allocates new ids / counts as needed.
   */
  public Record cloneViaReserialise() {
    // Do it via a re-serialization
    // It's a cheat, but it works...
    byte[] b = serialize();
    RecordInputStream rinp = new RecordInputStream(new ByteArrayInputStream(b));
    rinp.nextRecord();

    Record[] r = RecordFactory.createRecord(rinp);
    if(r.length != 1) {
      throw new IllegalStateException("Re-serialised a record to clone it, but got " + r.length + " records back!");
    }
    return r[0];
  }
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
   * Clone the current record, via a call to serialize
   *  it, and another to create a new record from the
   *  bytes.
   * May only be used for classes which don't have
   *  internal counts / ids in them. For those which
   *  do, a full model-aware cloning is needed, which
   *  allocates new ids / counts as needed.
   */
  public Record cloneViaReserialise() {
    // Do it via a re-serialization
    // It's a cheat, but it works...
    byte[] b = serialize();
    RecordInputStream rinp = new RecordInputStream(new ByteArrayInputStream(b));
    rinp.nextRecord();

    Record[] r = RecordFactory.createRecord(rinp);
    if(r.length != 1) {
      throw new IllegalStateException("Re-serialised a record to clone it, but got " + r.length + " records back!");
    }
    return r[0];
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
   * Clone the current record, via a call to serialize
   *  it, and another to create a new record from the
   *  bytes.
   * May only be used for classes which don't have
   *  internal counts / ids in them. For those which
   *  do, a full model-aware cloning is needed, which
   *  allocates new ids / counts as needed.
   * 
   * @return the cloned current record
   */
  public Record cloneViaReserialise() {
    // Do it via a re-serialization
    // It's a cheat, but it works...
    byte[] b = serialize();
    RecordInputStream rinp = new RecordInputStream(new ByteArrayInputStream(b));
    rinp.nextRecord();

    Record[] r = RecordFactory.createRecord(rinp);
    if(r.length != 1) {
      throw new IllegalStateException("Re-serialised a record to clone it, but got " + r.length + " records back!");
    }
    return r[0];
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

len = record.serialize( pos + offset, data );

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

len = record.serialize( pos + offset, data );

相关文章