org.apache.poi.hssf.record.IndexRecord Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of poi Show documentation
Show all versions of poi Show documentation
Apache POI - Java API To Access Microsoft Format Files
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.hssf.record;
import org.apache.poi.util.IntList;
import org.apache.poi.util.LittleEndianOutput;
import org.apache.poi.util.RecordFormatException;
import org.apache.poi.util.Removal;
/**
* Occurs right after BOF, tells you where the DBCELL records are for a sheet Important for locating cells
*/
public final class IndexRecord extends StandardRecord {
public static final short sid = 0x020B;
private int field_2_first_row; // first row on the sheet
private int field_3_last_row_add1; // last row
private int field_4_zero; // supposed to be zero
private IntList field_5_dbcells; // array of offsets to DBCELL records
public IndexRecord() {}
public IndexRecord(IndexRecord other) {
super(other);
field_2_first_row = other.field_2_first_row;
field_3_last_row_add1 = other.field_3_last_row_add1;
field_4_zero = other.field_4_zero;
field_5_dbcells = (other.field_5_dbcells == null) ? null : new IntList(other.field_5_dbcells);
}
public IndexRecord(RecordInputStream in) {
int field_1_zero = in.readInt();
if (field_1_zero != 0) {
throw new RecordFormatException("Expected zero for field 1 but got " + field_1_zero);
}
field_2_first_row = in.readInt();
field_3_last_row_add1 = in.readInt();
field_4_zero = in.readInt();
int nCells = in.remaining() / 4;
field_5_dbcells = new IntList(nCells);
for(int i=0; i