removed debugging code leftover from r682508 (patch 44894)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@682510 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
04d5f9c316
commit
73d5a60b68
@ -43,147 +43,147 @@ import java.util.Set;
|
|||||||
public final class RecordFactory {
|
public final class RecordFactory {
|
||||||
private static final int NUM_RECORDS = 512;
|
private static final int NUM_RECORDS = 512;
|
||||||
|
|
||||||
private static final Class[] CONSTRUCTOR_ARGS = { RecordInputStream.class, };
|
private static final Class[] CONSTRUCTOR_ARGS = { RecordInputStream.class, };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* contains the classes for all the records we want to parse.<br/>
|
* contains the classes for all the records we want to parse.<br/>
|
||||||
* Note - this most but not *every* subclass of Record.
|
* Note - this most but not *every* subclass of Record.
|
||||||
*/
|
*/
|
||||||
private static final Class[] records = {
|
private static final Class[] records = {
|
||||||
BackupRecord.class,
|
BackupRecord.class,
|
||||||
BlankRecord.class,
|
BlankRecord.class,
|
||||||
BOFRecord.class,
|
BOFRecord.class,
|
||||||
BookBoolRecord.class,
|
BookBoolRecord.class,
|
||||||
BoolErrRecord.class,
|
BoolErrRecord.class,
|
||||||
BottomMarginRecord.class,
|
BottomMarginRecord.class,
|
||||||
BoundSheetRecord.class,
|
BoundSheetRecord.class,
|
||||||
CalcCountRecord.class,
|
CalcCountRecord.class,
|
||||||
CalcModeRecord.class,
|
CalcModeRecord.class,
|
||||||
CFHeaderRecord.class,
|
CFHeaderRecord.class,
|
||||||
CFRuleRecord.class,
|
CFRuleRecord.class,
|
||||||
ChartRecord.class,
|
ChartRecord.class,
|
||||||
ChartTitleFormatRecord.class,
|
ChartTitleFormatRecord.class,
|
||||||
CodepageRecord.class,
|
CodepageRecord.class,
|
||||||
ColumnInfoRecord.class,
|
ColumnInfoRecord.class,
|
||||||
ContinueRecord.class,
|
ContinueRecord.class,
|
||||||
CountryRecord.class,
|
CountryRecord.class,
|
||||||
CRNCountRecord.class,
|
CRNCountRecord.class,
|
||||||
CRNRecord.class,
|
CRNRecord.class,
|
||||||
DateWindow1904Record.class,
|
DateWindow1904Record.class,
|
||||||
DBCellRecord.class,
|
DBCellRecord.class,
|
||||||
DefaultColWidthRecord.class,
|
DefaultColWidthRecord.class,
|
||||||
DefaultRowHeightRecord.class,
|
DefaultRowHeightRecord.class,
|
||||||
DeltaRecord.class,
|
DeltaRecord.class,
|
||||||
DimensionsRecord.class,
|
DimensionsRecord.class,
|
||||||
DrawingGroupRecord.class,
|
DrawingGroupRecord.class,
|
||||||
DrawingRecord.class,
|
DrawingRecord.class,
|
||||||
DrawingSelectionRecord.class,
|
DrawingSelectionRecord.class,
|
||||||
DSFRecord.class,
|
DSFRecord.class,
|
||||||
DVALRecord.class,
|
DVALRecord.class,
|
||||||
DVRecord.class,
|
DVRecord.class,
|
||||||
EOFRecord.class,
|
EOFRecord.class,
|
||||||
ExtendedFormatRecord.class,
|
ExtendedFormatRecord.class,
|
||||||
ExternalNameRecord.class,
|
ExternalNameRecord.class,
|
||||||
ExternSheetRecord.class,
|
ExternSheetRecord.class,
|
||||||
ExtSSTRecord.class,
|
ExtSSTRecord.class,
|
||||||
FilePassRecord.class,
|
FilePassRecord.class,
|
||||||
FileSharingRecord.class,
|
FileSharingRecord.class,
|
||||||
FnGroupCountRecord.class,
|
FnGroupCountRecord.class,
|
||||||
FontRecord.class,
|
FontRecord.class,
|
||||||
FooterRecord.class,
|
FooterRecord.class,
|
||||||
FormatRecord.class,
|
FormatRecord.class,
|
||||||
FormulaRecord.class,
|
FormulaRecord.class,
|
||||||
GridsetRecord.class,
|
GridsetRecord.class,
|
||||||
GutsRecord.class,
|
GutsRecord.class,
|
||||||
HCenterRecord.class,
|
HCenterRecord.class,
|
||||||
HeaderRecord.class,
|
HeaderRecord.class,
|
||||||
HideObjRecord.class,
|
HideObjRecord.class,
|
||||||
HorizontalPageBreakRecord.class,
|
HorizontalPageBreakRecord.class,
|
||||||
HyperlinkRecord.class,
|
HyperlinkRecord.class,
|
||||||
IndexRecord.class,
|
IndexRecord.class,
|
||||||
InterfaceEndRecord.class,
|
InterfaceEndRecord.class,
|
||||||
InterfaceHdrRecord.class,
|
InterfaceHdrRecord.class,
|
||||||
IterationRecord.class,
|
IterationRecord.class,
|
||||||
LabelRecord.class,
|
LabelRecord.class,
|
||||||
LabelSSTRecord.class,
|
LabelSSTRecord.class,
|
||||||
LeftMarginRecord.class,
|
LeftMarginRecord.class,
|
||||||
LegendRecord.class,
|
LegendRecord.class,
|
||||||
MergeCellsRecord.class,
|
MergeCellsRecord.class,
|
||||||
MMSRecord.class,
|
MMSRecord.class,
|
||||||
MulBlankRecord.class,
|
MulBlankRecord.class,
|
||||||
MulRKRecord.class,
|
MulRKRecord.class,
|
||||||
NameRecord.class,
|
NameRecord.class,
|
||||||
NoteRecord.class,
|
NoteRecord.class,
|
||||||
NumberRecord.class,
|
NumberRecord.class,
|
||||||
ObjectProtectRecord.class,
|
ObjectProtectRecord.class,
|
||||||
ObjRecord.class,
|
ObjRecord.class,
|
||||||
PaletteRecord.class,
|
PaletteRecord.class,
|
||||||
PaneRecord.class,
|
PaneRecord.class,
|
||||||
PasswordRecord.class,
|
PasswordRecord.class,
|
||||||
PasswordRev4Record.class,
|
PasswordRev4Record.class,
|
||||||
PrecisionRecord.class,
|
PrecisionRecord.class,
|
||||||
PrintGridlinesRecord.class,
|
PrintGridlinesRecord.class,
|
||||||
PrintHeadersRecord.class,
|
PrintHeadersRecord.class,
|
||||||
PrintSetupRecord.class,
|
PrintSetupRecord.class,
|
||||||
ProtectionRev4Record.class,
|
ProtectionRev4Record.class,
|
||||||
ProtectRecord.class,
|
ProtectRecord.class,
|
||||||
RecalcIdRecord.class,
|
RecalcIdRecord.class,
|
||||||
RefModeRecord.class,
|
RefModeRecord.class,
|
||||||
RefreshAllRecord.class,
|
RefreshAllRecord.class,
|
||||||
RightMarginRecord.class,
|
RightMarginRecord.class,
|
||||||
RKRecord.class,
|
RKRecord.class,
|
||||||
RowRecord.class,
|
RowRecord.class,
|
||||||
SaveRecalcRecord.class,
|
SaveRecalcRecord.class,
|
||||||
ScenarioProtectRecord.class,
|
ScenarioProtectRecord.class,
|
||||||
SelectionRecord.class,
|
SelectionRecord.class,
|
||||||
SeriesRecord.class,
|
SeriesRecord.class,
|
||||||
SeriesTextRecord.class,
|
SeriesTextRecord.class,
|
||||||
SharedFormulaRecord.class,
|
SharedFormulaRecord.class,
|
||||||
SSTRecord.class,
|
SSTRecord.class,
|
||||||
StringRecord.class,
|
StringRecord.class,
|
||||||
StyleRecord.class,
|
StyleRecord.class,
|
||||||
SupBookRecord.class,
|
SupBookRecord.class,
|
||||||
TabIdRecord.class,
|
TabIdRecord.class,
|
||||||
TableRecord.class,
|
TableRecord.class,
|
||||||
TextObjectRecord.class,
|
TextObjectRecord.class,
|
||||||
TopMarginRecord.class,
|
TopMarginRecord.class,
|
||||||
UncalcedRecord.class,
|
UncalcedRecord.class,
|
||||||
UseSelFSRecord.class,
|
UseSelFSRecord.class,
|
||||||
VCenterRecord.class,
|
VCenterRecord.class,
|
||||||
VerticalPageBreakRecord.class,
|
VerticalPageBreakRecord.class,
|
||||||
WindowOneRecord.class,
|
WindowOneRecord.class,
|
||||||
WindowProtectRecord.class,
|
WindowProtectRecord.class,
|
||||||
WindowTwoRecord.class,
|
WindowTwoRecord.class,
|
||||||
WriteAccessRecord.class,
|
WriteAccessRecord.class,
|
||||||
WriteProtectRecord.class,
|
WriteProtectRecord.class,
|
||||||
WSBoolRecord.class,
|
WSBoolRecord.class,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cache of the recordsToMap();
|
* cache of the recordsToMap();
|
||||||
*/
|
*/
|
||||||
private static Map recordsMap = recordsToMap(records);
|
private static Map recordsMap = recordsToMap(records);
|
||||||
|
|
||||||
private static short[] _allKnownRecordSIDs;
|
private static short[] _allKnownRecordSIDs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create a record, if there are MUL records than multiple records
|
* create a record, if there are MUL records than multiple records
|
||||||
* 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) {
|
||||||
Constructor constructor = (Constructor) recordsMap.get(new Short(in.getSid()));
|
Constructor constructor = (Constructor) recordsMap.get(new Short(in.getSid()));
|
||||||
|
|
||||||
if (constructor == null) {
|
if (constructor == null) {
|
||||||
return new Record[] { new UnknownRecord(in), };
|
return new Record[] { new UnknownRecord(in), };
|
||||||
}
|
}
|
||||||
|
|
||||||
Record retval;
|
Record retval;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
retval = ( Record ) constructor.newInstance(new Object[] { in });
|
retval = ( Record ) constructor.newInstance(new Object[] { in });
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
throw new RecordFormatException("Unable to construct record instance" , e.getTargetException());
|
throw new RecordFormatException("Unable to construct record instance" , e.getTargetException());
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
@ -191,184 +191,182 @@ public final class RecordFactory {
|
|||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval instanceof RKRecord) {
|
if (retval instanceof RKRecord) {
|
||||||
// RK record is a slightly smaller alternative to NumberRecord
|
// RK record is a slightly smaller alternative to NumberRecord
|
||||||
// POI likes NumberRecord better
|
// POI likes NumberRecord better
|
||||||
RKRecord rk = ( RKRecord ) retval;
|
RKRecord rk = ( RKRecord ) retval;
|
||||||
NumberRecord num = new NumberRecord();
|
NumberRecord num = new NumberRecord();
|
||||||
|
|
||||||
num.setColumn(rk.getColumn());
|
num.setColumn(rk.getColumn());
|
||||||
num.setRow(rk.getRow());
|
num.setRow(rk.getRow());
|
||||||
num.setXFIndex(rk.getXFIndex());
|
num.setXFIndex(rk.getXFIndex());
|
||||||
num.setValue(rk.getRKNumber());
|
num.setValue(rk.getRKNumber());
|
||||||
return new Record[] { num, };
|
return new Record[] { num, };
|
||||||
}
|
}
|
||||||
if (retval instanceof DBCellRecord) {
|
if (retval 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
|
||||||
return new Record[] { null, };
|
return new Record[] { null, };
|
||||||
}
|
}
|
||||||
// expand multiple records where necessary
|
// expand multiple records where necessary
|
||||||
if (retval instanceof MulRKRecord) {
|
if (retval instanceof MulRKRecord) {
|
||||||
MulRKRecord mrk = ( MulRKRecord ) retval;
|
MulRKRecord mrk = ( MulRKRecord ) retval;
|
||||||
|
|
||||||
Record[] mulRecs = new Record[ mrk.getNumColumns() ];
|
Record[] mulRecs = new Record[ mrk.getNumColumns() ];
|
||||||
for (int k = 0; k < mrk.getNumColumns(); k++) {
|
for (int k = 0; k < mrk.getNumColumns(); k++) {
|
||||||
NumberRecord nr = new NumberRecord();
|
NumberRecord nr = new NumberRecord();
|
||||||
|
|
||||||
nr.setColumn(( short ) (k + mrk.getFirstColumn()));
|
nr.setColumn(( short ) (k + mrk.getFirstColumn()));
|
||||||
nr.setRow(mrk.getRow());
|
nr.setRow(mrk.getRow());
|
||||||
nr.setXFIndex(mrk.getXFAt(k));
|
nr.setXFIndex(mrk.getXFAt(k));
|
||||||
nr.setValue(mrk.getRKNumberAt(k));
|
nr.setValue(mrk.getRKNumberAt(k));
|
||||||
mulRecs[ k ] = nr;
|
mulRecs[ k ] = nr;
|
||||||
}
|
}
|
||||||
return mulRecs;
|
return mulRecs;
|
||||||
}
|
}
|
||||||
if (retval instanceof MulBlankRecord) {
|
if (retval instanceof MulBlankRecord) {
|
||||||
MulBlankRecord mb = ( MulBlankRecord ) retval;
|
MulBlankRecord mb = ( MulBlankRecord ) retval;
|
||||||
|
|
||||||
Record[] mulRecs = new Record[ mb.getNumColumns() ];
|
Record[] mulRecs = new Record[ mb.getNumColumns() ];
|
||||||
for (int k = 0; k < mb.getNumColumns(); k++) {
|
for (int k = 0; k < mb.getNumColumns(); k++) {
|
||||||
BlankRecord br = new BlankRecord();
|
BlankRecord br = new BlankRecord();
|
||||||
|
|
||||||
br.setColumn(( short ) (k + mb.getFirstColumn()));
|
br.setColumn(( short ) (k + mb.getFirstColumn()));
|
||||||
br.setRow(mb.getRow());
|
br.setRow(mb.getRow());
|
||||||
br.setXFIndex(mb.getXFAt(k));
|
br.setXFIndex(mb.getXFAt(k));
|
||||||
mulRecs[ k ] = br;
|
mulRecs[ k ] = br;
|
||||||
}
|
}
|
||||||
return mulRecs;
|
return mulRecs;
|
||||||
}
|
}
|
||||||
return new Record[] { retval, };
|
return new Record[] { retval, };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return an array of all the SIDS for all known records
|
* @return an array of all the SIDS for all known records
|
||||||
*/
|
*/
|
||||||
public static short[] getAllKnownRecordSIDs() {
|
public static short[] getAllKnownRecordSIDs() {
|
||||||
if (_allKnownRecordSIDs == null) {
|
if (_allKnownRecordSIDs == null) {
|
||||||
short[] results = new short[ recordsMap.size() ];
|
short[] results = new short[ recordsMap.size() ];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (Iterator iterator = recordsMap.keySet().iterator(); iterator.hasNext(); ) {
|
for (Iterator iterator = recordsMap.keySet().iterator(); iterator.hasNext(); ) {
|
||||||
Short sid = (Short) iterator.next();
|
Short sid = (Short) iterator.next();
|
||||||
|
|
||||||
results[i++] = sid.shortValue();
|
results[i++] = sid.shortValue();
|
||||||
}
|
}
|
||||||
Arrays.sort(results);
|
Arrays.sort(results);
|
||||||
_allKnownRecordSIDs = results;
|
_allKnownRecordSIDs = results;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (short[]) _allKnownRecordSIDs.clone();
|
return (short[]) _allKnownRecordSIDs.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gets the record constructors and sticks them in the map by SID
|
* gets the record constructors and sticks them in the map by SID
|
||||||
* @return map of SIDs to short,short,byte[] constructors for Record classes
|
* @return map of SIDs to short,short,byte[] constructors for Record classes
|
||||||
* most of org.apache.poi.hssf.record.*
|
* most of org.apache.poi.hssf.record.*
|
||||||
*/
|
*/
|
||||||
private static Map recordsToMap(Class [] records) {
|
private static Map recordsToMap(Class [] records) {
|
||||||
Map result = new HashMap();
|
Map result = new HashMap();
|
||||||
Set uniqueRecClasses = new HashSet(records.length * 3 / 2);
|
Set uniqueRecClasses = new HashSet(records.length * 3 / 2);
|
||||||
|
|
||||||
for (int i = 0; i < records.length; i++) {
|
for (int i = 0; i < records.length; i++) {
|
||||||
|
|
||||||
Class recClass = records[ i ];
|
Class recClass = records[ i ];
|
||||||
String cn = recClass.getName();
|
if(!Record.class.isAssignableFrom(recClass)) {
|
||||||
System.out.println(cn.substring(cn.lastIndexOf('.')+1) + ".class,");
|
throw new RuntimeException("Invalid record sub-class (" + recClass.getName() + ")");
|
||||||
if(!Record.class.isAssignableFrom(recClass)) {
|
}
|
||||||
throw new RuntimeException("Invalid record sub-class (" + cn + ")");
|
if(Modifier.isAbstract(recClass.getModifiers())) {
|
||||||
}
|
throw new RuntimeException("Invalid record class (" + recClass.getName() + ") - must not be abstract");
|
||||||
if(Modifier.isAbstract(recClass.getModifiers())) {
|
}
|
||||||
throw new RuntimeException("Invalid record class (" + cn + ") - must not be abstract");
|
if(!uniqueRecClasses.add(recClass)) {
|
||||||
}
|
throw new RuntimeException("duplicate record class (" + recClass.getName() + ")");
|
||||||
if(!uniqueRecClasses.add(recClass)) {
|
}
|
||||||
throw new RuntimeException("duplicate record class (" + cn + ")");
|
|
||||||
}
|
short sid;
|
||||||
|
Constructor constructor;
|
||||||
short sid;
|
try {
|
||||||
Constructor constructor;
|
sid = recClass.getField("sid").getShort(null);
|
||||||
try {
|
constructor = recClass.getConstructor(CONSTRUCTOR_ARGS);
|
||||||
sid = recClass.getField("sid").getShort(null);
|
} catch (Exception illegalArgumentException) {
|
||||||
constructor = recClass.getConstructor(CONSTRUCTOR_ARGS);
|
throw new RecordFormatException(
|
||||||
} catch (Exception illegalArgumentException) {
|
"Unable to determine record types");
|
||||||
throw new RecordFormatException(
|
}
|
||||||
"Unable to determine record types");
|
Short key = new Short(sid);
|
||||||
}
|
|
||||||
Short key = new Short(sid);
|
|
||||||
if (result.containsKey(key)) {
|
if (result.containsKey(key)) {
|
||||||
Class prev = (Class)result.get(key);
|
Class prev = (Class)result.get(key);
|
||||||
throw new RuntimeException("duplicate record sid 0x" + Integer.toHexString(sid).toUpperCase()
|
throw new RuntimeException("duplicate record sid 0x" + Integer.toHexString(sid).toUpperCase()
|
||||||
+ " for classes (" + cn + ") and (" + prev.getName() + ")");
|
+ " for classes (" + recClass.getName() + ") and (" + prev.getName() + ")");
|
||||||
}
|
}
|
||||||
result.put(key, constructor);
|
result.put(key, constructor);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an array of records from an input stream
|
* Create an array of records from an input stream
|
||||||
*
|
*
|
||||||
* @param in the InputStream from which the records will be obtained
|
* @param in the InputStream from which the records will be obtained
|
||||||
*
|
*
|
||||||
* @return an array of Records created from the InputStream
|
* @return an array of Records created from the InputStream
|
||||||
*
|
*
|
||||||
* @exception RecordFormatException on error processing the InputStream
|
* @exception RecordFormatException on error processing the InputStream
|
||||||
*/
|
*/
|
||||||
public static List createRecords(InputStream in) throws RecordFormatException {
|
public static List createRecords(InputStream in) throws RecordFormatException {
|
||||||
|
|
||||||
List records = new ArrayList(NUM_RECORDS);
|
List records = new ArrayList(NUM_RECORDS);
|
||||||
|
|
||||||
RecordInputStream recStream = new RecordInputStream(in);
|
RecordInputStream recStream = new RecordInputStream(in);
|
||||||
DrawingRecord lastDrawingRecord = new DrawingRecord( );
|
DrawingRecord lastDrawingRecord = new DrawingRecord( );
|
||||||
Record lastRecord = null;
|
Record lastRecord = null;
|
||||||
while (recStream.hasNextRecord()) {
|
while (recStream.hasNextRecord()) {
|
||||||
recStream.nextRecord();
|
recStream.nextRecord();
|
||||||
if (recStream.getSid() != 0) {
|
if (recStream.getSid() != 0) {
|
||||||
Record[] recs = createRecord(recStream); // handle MulRK records
|
Record[] recs = createRecord(recStream); // handle MulRK records
|
||||||
|
|
||||||
if (recs.length > 1) {
|
if (recs.length > 1) {
|
||||||
for (int k = 0; k < recs.length; k++) {
|
for (int k = 0; k < recs.length; k++) {
|
||||||
records.add(recs[ k ]); // these will be number records
|
records.add(recs[ k ]); // these will be number records
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Record record = recs[ 0 ];
|
Record record = recs[ 0 ];
|
||||||
|
|
||||||
if (record != null) {
|
if (record != null) {
|
||||||
if (record.getSid() == DrawingGroupRecord.sid
|
if (record.getSid() == DrawingGroupRecord.sid
|
||||||
&& lastRecord instanceof DrawingGroupRecord) {
|
&& lastRecord instanceof DrawingGroupRecord) {
|
||||||
DrawingGroupRecord lastDGRecord = (DrawingGroupRecord) lastRecord;
|
DrawingGroupRecord lastDGRecord = (DrawingGroupRecord) lastRecord;
|
||||||
lastDGRecord.join((AbstractEscherHolderRecord) record);
|
lastDGRecord.join((AbstractEscherHolderRecord) record);
|
||||||
} else if (record.getSid() == ContinueRecord.sid &&
|
} else if (record.getSid() == ContinueRecord.sid &&
|
||||||
((lastRecord instanceof ObjRecord) || (lastRecord instanceof TextObjectRecord))) {
|
((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.
|
||||||
lastDrawingRecord.processContinueRecord( ((ContinueRecord)record).getData() );
|
lastDrawingRecord.processContinueRecord( ((ContinueRecord)record).getData() );
|
||||||
//we must remember the position of the continue record.
|
//we must remember the position of the continue record.
|
||||||
//in the serialization procedure the original structure of records must be preserved
|
//in the serialization procedure the original structure of records must be preserved
|
||||||
records.add(record);
|
records.add(record);
|
||||||
} else if (record.getSid() == ContinueRecord.sid &&
|
} else if (record.getSid() == ContinueRecord.sid &&
|
||||||
(lastRecord instanceof DrawingGroupRecord)) {
|
(lastRecord instanceof DrawingGroupRecord)) {
|
||||||
((DrawingGroupRecord)lastRecord).processContinueRecord(((ContinueRecord)record).getData());
|
((DrawingGroupRecord)lastRecord).processContinueRecord(((ContinueRecord)record).getData());
|
||||||
} else if (record.getSid() == ContinueRecord.sid &&
|
} else if (record.getSid() == ContinueRecord.sid &&
|
||||||
(lastRecord instanceof StringRecord)) {
|
(lastRecord instanceof StringRecord)) {
|
||||||
((StringRecord)lastRecord).processContinueRecord(((ContinueRecord)record).getData());
|
((StringRecord)lastRecord).processContinueRecord(((ContinueRecord)record).getData());
|
||||||
} else if (record.getSid() == ContinueRecord.sid) {
|
} else if (record.getSid() == ContinueRecord.sid) {
|
||||||
if (lastRecord instanceof UnknownRecord) {
|
if (lastRecord instanceof UnknownRecord) {
|
||||||
//Gracefully handle records that we dont know about,
|
//Gracefully handle records that we dont know about,
|
||||||
//that happen to be continued
|
//that happen to be continued
|
||||||
records.add(record);
|
records.add(record);
|
||||||
} else
|
} else
|
||||||
throw new RecordFormatException("Unhandled Continue Record");
|
throw new RecordFormatException("Unhandled Continue Record");
|
||||||
} else {
|
} else {
|
||||||
lastRecord = record;
|
lastRecord = record;
|
||||||
if (record instanceof DrawingRecord) {
|
if (record instanceof DrawingRecord) {
|
||||||
lastDrawingRecord = (DrawingRecord) record;
|
lastDrawingRecord = (DrawingRecord) record;
|
||||||
}
|
}
|
||||||
records.add(record);
|
records.add(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return records;
|
return records;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user