Removed trailing whitespace in RecordFactory
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@784247 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
635c570598
commit
383e9e4a40
@ -45,7 +45,7 @@ import org.apache.poi.hssf.record.pivottable.*;
|
|||||||
*/
|
*/
|
||||||
public final class RecordFactory {
|
public final class RecordFactory {
|
||||||
private static final int NUM_RECORDS = 512;
|
private static final int NUM_RECORDS = 512;
|
||||||
|
|
||||||
private interface I_RecordCreator {
|
private interface I_RecordCreator {
|
||||||
Record create(RecordInputStream in);
|
Record create(RecordInputStream in);
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ public final class RecordFactory {
|
|||||||
WriteAccessRecord.class,
|
WriteAccessRecord.class,
|
||||||
WriteProtectRecord.class,
|
WriteProtectRecord.class,
|
||||||
WSBoolRecord.class,
|
WSBoolRecord.class,
|
||||||
|
|
||||||
// chart records
|
// chart records
|
||||||
BeginRecord.class,
|
BeginRecord.class,
|
||||||
ChartFRTInfoRecord.class,
|
ChartFRTInfoRecord.class,
|
||||||
@ -206,29 +206,29 @@ public final class RecordFactory {
|
|||||||
EndRecord.class,
|
EndRecord.class,
|
||||||
LinkedDataRecord.class,
|
LinkedDataRecord.class,
|
||||||
SeriesToChartGroupRecord.class,
|
SeriesToChartGroupRecord.class,
|
||||||
|
|
||||||
// pivot table records
|
// pivot table records
|
||||||
DataItemRecord.class,
|
DataItemRecord.class,
|
||||||
ExtendedPivotTableViewFieldsRecord.class,
|
ExtendedPivotTableViewFieldsRecord.class,
|
||||||
PageItemRecord.class,
|
PageItemRecord.class,
|
||||||
StreamIDRecord.class,
|
StreamIDRecord.class,
|
||||||
ViewDefinitionRecord.class,
|
ViewDefinitionRecord.class,
|
||||||
ViewFieldsRecord.class,
|
ViewFieldsRecord.class,
|
||||||
ViewSourceRecord.class,
|
ViewSourceRecord.class,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cache of the recordsToMap();
|
* cache of the recordsToMap();
|
||||||
*/
|
*/
|
||||||
private static final Map<Integer, I_RecordCreator> _recordCreatorsById = recordsToMap(recordClasses);
|
private static final Map<Integer, I_RecordCreator> _recordCreatorsById = recordsToMap(recordClasses);
|
||||||
|
|
||||||
private static short[] _allKnownRecordSIDs;
|
private static short[] _allKnownRecordSIDs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Debug / diagnosis method<br/>
|
* Debug / diagnosis method<br/>
|
||||||
* Gets the POI implementation class for a given <tt>sid</tt>. Only a subset of the any BIFF
|
* Gets the POI implementation class for a given <tt>sid</tt>. Only a subset of the any BIFF
|
||||||
* records are actually interpreted by POI. A few others are known but not interpreted
|
* records are actually interpreted by POI. A few others are known but not interpreted
|
||||||
* (see {@link UnknownRecord#getBiffName(int)}).
|
* (see {@link UnknownRecord#getBiffName(int)}).
|
||||||
* @return the POI implementation class for the specified record <tt>sid</tt>.
|
* @return the POI implementation class for the specified record <tt>sid</tt>.
|
||||||
* <code>null</code> if the specified record is not interpreted by POI.
|
* <code>null</code> if the specified record is not interpreted by POI.
|
||||||
*/
|
*/
|
||||||
@ -244,7 +244,7 @@ public final class RecordFactory {
|
|||||||
* are returned digested into the non-mul form.
|
* are returned digested into the non-mul form.
|
||||||
*/
|
*/
|
||||||
public static Record [] createRecord(RecordInputStream in) {
|
public static Record [] createRecord(RecordInputStream in) {
|
||||||
|
|
||||||
Record record = createSingleRecord(in);
|
Record record = createSingleRecord(in);
|
||||||
if (record instanceof DBCellRecord) {
|
if (record instanceof DBCellRecord) {
|
||||||
// Not needed by POI. Regenerated from scratch by POI when spreadsheet is written
|
// Not needed by POI. Regenerated from scratch by POI when spreadsheet is written
|
||||||
@ -258,14 +258,14 @@ public final class RecordFactory {
|
|||||||
}
|
}
|
||||||
return new Record[] { record, };
|
return new Record[] { record, };
|
||||||
}
|
}
|
||||||
|
|
||||||
static Record createSingleRecord(RecordInputStream in) {
|
static Record createSingleRecord(RecordInputStream in) {
|
||||||
I_RecordCreator constructor = _recordCreatorsById.get(new Integer(in.getSid()));
|
I_RecordCreator constructor = _recordCreatorsById.get(new Integer(in.getSid()));
|
||||||
|
|
||||||
if (constructor == null) {
|
if (constructor == null) {
|
||||||
return new UnknownRecord(in);
|
return new UnknownRecord(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
return constructor.create(in);
|
return constructor.create(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ public final class RecordFactory {
|
|||||||
if(!uniqueRecClasses.add(recClass)) {
|
if(!uniqueRecClasses.add(recClass)) {
|
||||||
throw new RuntimeException("duplicate record class (" + recClass.getName() + ")");
|
throw new RuntimeException("duplicate record class (" + recClass.getName() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
short sid;
|
short sid;
|
||||||
Constructor<? extends Record> constructor;
|
Constructor<? extends Record> constructor;
|
||||||
try {
|
try {
|
||||||
@ -360,6 +360,7 @@ public final class RecordFactory {
|
|||||||
}
|
}
|
||||||
result.put(key, new ReflectionRecordCreator(constructor));
|
result.put(key, new ReflectionRecordCreator(constructor));
|
||||||
}
|
}
|
||||||
|
// result.put(new Integer(0x0406), result.get(new Integer(0x06)));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,17 +387,17 @@ public final class RecordFactory {
|
|||||||
* reliably use zeros for padding and if this were always the case, this code could just
|
* reliably use zeros for padding and if this were always the case, this code could just
|
||||||
* skip all the (zero sized) records with sid==0. However, bug 46987 shows a file with
|
* skip all the (zero sized) records with sid==0. However, bug 46987 shows a file with
|
||||||
* non-zero padding that is read OK by Excel (Excel also fixes the padding).
|
* non-zero padding that is read OK by Excel (Excel also fixes the padding).
|
||||||
*
|
*
|
||||||
* So to properly detect the workbook end of stream, this code has to identify the last
|
* So to properly detect the workbook end of stream, this code has to identify the last
|
||||||
* EOF record. This is not so easy because the worbook bof+eof pair do not bracket the
|
* EOF record. This is not so easy because the worbook bof+eof pair do not bracket the
|
||||||
* whole stream. The worksheets follow the workbook, but it is not easy to tell how many
|
* whole stream. The worksheets follow the workbook, but it is not easy to tell how many
|
||||||
* sheet sub-streams should be present. Hence we are looking for an EOF record that is not
|
* sheet sub-streams should be present. Hence we are looking for an EOF record that is not
|
||||||
* immediately followed by a BOF record. One extra complication is that bof+eof sub-
|
* immediately followed by a BOF record. One extra complication is that bof+eof sub-
|
||||||
* streams can be nested within worksheet streams and it's not clear in these cases what
|
* streams can be nested within worksheet streams and it's not clear in these cases what
|
||||||
* record might follow any EOF record. So we also need to keep track of the bof/eof
|
* record might follow any EOF record. So we also need to keep track of the bof/eof
|
||||||
* nesting level.
|
* nesting level.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int bofDepth=0;
|
int bofDepth=0;
|
||||||
boolean lastRecordWasEOFLevelZero = false;
|
boolean lastRecordWasEOFLevelZero = false;
|
||||||
while (recStream.hasNextRecord()) {
|
while (recStream.hasNextRecord()) {
|
||||||
@ -420,7 +421,7 @@ public final class RecordFactory {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (record instanceof DBCellRecord) {
|
if (record instanceof DBCellRecord) {
|
||||||
// Not needed by POI. Regenerated from scratch by POI when spreadsheet is written
|
// Not needed by POI. Regenerated from scratch by POI when spreadsheet is written
|
||||||
continue;
|
continue;
|
||||||
@ -441,7 +442,7 @@ public final class RecordFactory {
|
|||||||
lastDGRecord.join((AbstractEscherHolderRecord) record);
|
lastDGRecord.join((AbstractEscherHolderRecord) record);
|
||||||
} else if (record.getSid() == ContinueRecord.sid) {
|
} else if (record.getSid() == ContinueRecord.sid) {
|
||||||
ContinueRecord contRec = (ContinueRecord)record;
|
ContinueRecord contRec = (ContinueRecord)record;
|
||||||
|
|
||||||
if (lastRecord instanceof ObjRecord || lastRecord instanceof TextObjectRecord) {
|
if (lastRecord instanceof ObjRecord || lastRecord instanceof TextObjectRecord) {
|
||||||
// Drawing records have a very strange continue behaviour.
|
// Drawing records have a very strange continue behaviour.
|
||||||
//There can actually be OBJ records mixed between the continues.
|
//There can actually be OBJ records mixed between the continues.
|
||||||
|
Loading…
Reference in New Issue
Block a user