本文整理汇总了C#中NPOI.HSSF.Record.RecordInputStream.ReadRemainder方法的典型用法代码示例。如果您正苦于以下问题:C# RecordInputStream.ReadRemainder方法的具体用法?C# RecordInputStream.ReadRemainder怎么用?C# RecordInputStream.ReadRemainder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPOI.HSSF.Record.RecordInputStream
的用法示例。
在下文中一共展示了RecordInputStream.ReadRemainder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ObjRecord
/**
* Constructs a OBJ record and Sets its fields appropriately.
*
* @param in the RecordInputstream to Read the record from
*/
public ObjRecord(RecordInputStream in1)
{
subrecords = new ArrayList();
//Check if this can be continued, if so then the
//following wont work properly
int subSize = 0;
byte[] subRecordData = in1.ReadRemainder();
RecordInputStream subRecStream = new RecordInputStream(new MemoryStream(subRecordData));
while (subRecStream.HasNextRecord)
{
subRecStream.NextRecord();
Record subRecord = SubRecord.CreateSubRecord(subRecStream);
subSize += subRecord.RecordSize;
subrecords.Add(subRecord);
}
/**
* Add the EndSubRecord explicitly.
*
* TODO - the reason the EndSubRecord Is always skipped Is because its 'sid' Is zero and
* that causes subRecStream.HasNextRecord() to return false.
* There may be more than the size of EndSubRecord left-over, if there Is any pAdding
* after that record. The content of the EndSubRecord and the pAdding Is all zeros.
* So there's not much to look at past the last substantial record.
*
* See Bugs 41242/45133 for details.
*/
if (subRecordData.Length - subSize >= 4)
{
subrecords.Add(new EndSubRecord());
}
}
示例2: StyleRecord
/**
* Constructs a Style record and Sets its fields appropriately.
* @param in the RecordInputstream to Read the record from
*/
public StyleRecord(RecordInputStream in1)
{
fHighByte = BitFieldFactory.GetInstance(0x01); //have to init here, since we are being called
//from base, and class level init hasnt been done.
field_1_xf_index = in1.ReadShort();
if (Type == STYLE_BUILT_IN)
{
field_2_builtin_style = (byte)in1.ReadByte();
field_3_outline_style_level = (byte)in1.ReadByte();
}
else if (Type == STYLE_USER_DEFINED)
{
field_2_name_length = in1.ReadShort();
// Some files from Crystal Reports lack
// the remaining fields, which Is naughty
if (in1.Remaining > 0)
{
field_3_string_options = (byte)in1.ReadByte();
byte[] str = in1.ReadRemainder();
if (fHighByte.IsSet(field_3_string_options))
{
field_4_name = StringUtil.GetFromUnicodeBE(str, 0, field_2_name_length);
}
else
{
field_4_name = StringUtil.GetFromCompressedUnicode(str, 0, field_2_name_length);
}
}
}
// todo sanity Check exception to make sure we're one or the other
}
示例3: LabelRecord
/**
* Constructs an Label record and Sets its fields appropriately.
*
* @param in the RecordInputstream to Read the record from
*/
public LabelRecord(RecordInputStream in1)
{
field_1_row = in1.ReadUShort();
field_2_column = in1.ReadUShort();
field_3_xf_index = in1.ReadShort();
field_4_string_len = in1.ReadShort();
field_5_unicode_flag = (byte)in1.ReadByte();
if (field_4_string_len > 0)
{
if (IsUncompressedUnicode)
{
field_6_value = in1.ReadUnicodeLEString(field_4_string_len);
}
else
{
field_6_value = in1.ReadCompressedUnicode(field_4_string_len);
}
}
else
{
field_6_value = "";
}
if (in1.Remaining > 0)
{
logger.Log(POILogger.INFO, "LabelRecord data remains: " +in1.Remaining +
" : " + HexDump.ToHex(in1.ReadRemainder()));
}
}
示例4: UnknownRecord
/**
* construct an Unknown record. No fields are interperated and the record will
* be Serialized in its original form more or less
* @param in the RecordInputstream to Read the record from
*/
public UnknownRecord(RecordInputStream in1)
{
_sid = in1.Sid;
_rawData = in1.ReadRemainder();
//Console.WriteLine("UnknownRecord: 0x"+StringUtil.ToHexString(sid));
}
示例5: WSBoolRecord
/**
* Constructs a WSBool record and Sets its fields appropriately.
* @param in the RecordInputstream to Read the record from
*/
public WSBoolRecord(RecordInputStream in1)
{
byte[] data = in1.ReadRemainder();
field_1_wsbool =
data[ 0 ];
field_2_wsbool =
data[ 1 ];
}
示例6: WSBoolRecord
/**
* Constructs a WSBool record and Sets its fields appropriately.
* @param in the RecordInputstream to Read the record from
*/
public WSBoolRecord(RecordInputStream in1)
{
byte[] data = in1.ReadRemainder();
field_1_wsbool =
data[ 1 ]; // backwards because theoretically this Is one short field
field_2_wsbool =
data[ 0 ]; // but it was easier to implement it this way to avoid confusion
// because the dev kit shows the masks for it as 2 byte fields
}
示例7: FeatProtection
public FeatProtection(RecordInputStream in1)
{
fSD = in1.ReadInt();
passwordVerifier = in1.ReadInt();
title = StringUtil.ReadUnicodeString(in1);
securityDescriptor = in1.ReadRemainder();
}
示例8: NoteRecord
/**
* Constructs a <c>NoteRecord</c> and Fills its fields
* from the supplied <c>RecordInputStream</c>.
*
* @param in the stream to Read from
*/
public NoteRecord(RecordInputStream in1)
{
field_1_row = in1.ReadShort();
field_2_col = in1.ReadShort();
field_3_flags = in1.ReadShort();
field_4_shapeid = in1.ReadShort();
int Length = in1.ReadShort();
byte[] bytes = in1.ReadRemainder();
field_5_author = Encoding.UTF8.GetString(bytes, 1, Length);
}
示例9: WriteAccessRecord
/**
* Constructs a WriteAccess record and Sets its fields appropriately.
* @param in the RecordInputstream to Read the record from
*/
public WriteAccessRecord(RecordInputStream in1)
{
byte[] data = in1.ReadRemainder();
//The string Is always 112 Chars (pAdded with spaces), therefore
//this record can not be continued.
//What a wierd record, it Is not really a Unicode string because the
//header doesnt provide a correct size indication.???
//But the header Is present, so we need to skip over it.
//Odd, Odd, Odd ;-)
field_1_username = StringUtil.GetFromCompressedUnicode(data, 3, data.Length - 3);
}
示例10: AbstractEscherHolderRecord
/**
* Constructs a Bar record and Sets its fields appropriately.
*
* @param in the RecordInputstream to Read the record from
*/
public AbstractEscherHolderRecord(RecordInputStream in1)
{
escherRecords = new ArrayList();
if (!DESERIALISE)
{
rawData = in1.ReadRemainder();
}
else
{
byte[] data = in1.ReadAllContinuedRemainder();
ConvertToEscherRecords(0, data.Length, data);
}
}
示例11: StringRecord
/**
* Constructs a String record and Sets its fields appropriately.
*
* @param in the RecordInputstream to Read the record from
*/
public StringRecord(RecordInputStream in1)
{
int field_1_string_Length = in1.ReadShort();
field_2_unicode_flag = in1.ReadByte() != 0x00;
byte[] data = in1.ReadRemainder();
//Why Isnt this using the in1.ReadString methods???
if (field_2_unicode_flag)
{
field_3_string = StringUtil.GetFromUnicodeLE(data, 0, field_1_string_Length);
}
else
{
field_3_string = StringUtil.GetFromCompressedUnicode(data, 0, field_1_string_Length);
}
}
示例12: OldLabelRecord
/**
* @param in the RecordInputstream to read the record from
*/
public OldLabelRecord(RecordInputStream in1)
: base(in1, in1.Sid == biff2_sid)
{
if (IsBiff2)
{
field_4_string_len = (short)in1.ReadUByte();
}
else
{
field_4_string_len = in1.ReadShort();
}
// Can only decode properly later when you know the codepage
field_5_bytes = new byte[field_4_string_len];
in1.Read(field_5_bytes, 0, field_4_string_len);
if (in1.Remaining > 0)
{
logger.Log(POILogger.INFO,
"LabelRecord data remains: " + in1.Remaining +
" : " + HexDump.ToHex(in1.ReadRemainder())
);
}
}
示例13: NoteStructureSubRecord
/**
* Constructs a NoteStructureSubRecord and Sets its fields appropriately.
*
*/
public NoteStructureSubRecord(RecordInputStream in1)
{
//just grab the raw data
reserved = in1.ReadRemainder();
}
示例14: DrawingRecord
public DrawingRecord(RecordInputStream in1)
{
recordData = in1.ReadRemainder();
}
示例15: ObjRecord
/**
* Constructs a OBJ record and Sets its fields appropriately.
*
* @param in the RecordInputstream to Read the record from
*/
public ObjRecord(RecordInputStream in1)
{
// TODO - problems with OBJ sub-records stream
// MS spec says first sub-record is always CommonObjectDataSubRecord,
// and last is
// always EndSubRecord. OOO spec does not mention ObjRecord(0x005D).
// Existing POI test data seems to violate that rule. Some test data
// seems to contain
// garbage, and a crash is only averted by stopping at what looks like
// the 'EndSubRecord'
//Check if this can be continued, if so then the
//following wont work properly
int subSize = 0;
byte[] subRecordData = in1.ReadRemainder();
if (LittleEndian.GetUShort(subRecordData, 0) != CommonObjectDataSubRecord.sid)
{
// seems to occur in just one junit on "OddStyleRecord.xls" (file created by CrystalReports)
// Excel tolerates the funny ObjRecord, and replaces it with a corrected version
// The exact logic/reasoning is not yet understood
_uninterpretedData = subRecordData;
subrecords = null;
return;
}
//if (subRecordData.Length % 2 != 0)
//{
// String msg = "Unexpected length of subRecordData : " + HexDump.ToHex(subRecordData);
// throw new RecordFormatException(msg);
//}
subrecords = new List<SubRecord>();
MemoryStream bais = new MemoryStream(subRecordData);
LittleEndianInputStream subRecStream = new LittleEndianInputStream(bais);
CommonObjectDataSubRecord cmo = (CommonObjectDataSubRecord)SubRecord.CreateSubRecord(subRecStream, 0);
subrecords.Add(cmo);
while (true)
{
SubRecord subRecord = SubRecord.CreateSubRecord(subRecStream, cmo.ObjectType);
subrecords.Add(subRecord);
if (subRecord.IsTerminating) {
break;
}
}
int nRemainingBytes = subRecStream.Available();
if (nRemainingBytes > 0)
{
// At present (Oct-2008), most unit test samples have (subRecordData.length % 2 == 0)
_isPaddedToQuadByteMultiple = subRecordData.Length % MAX_PAD_ALIGNMENT == 0;
if (nRemainingBytes >= (_isPaddedToQuadByteMultiple ? MAX_PAD_ALIGNMENT : NORMAL_PAD_ALIGNMENT))
{
if (!CanPaddingBeDiscarded(subRecordData, nRemainingBytes))
{
String msg = "Leftover " + nRemainingBytes
+ " bytes in subrecord data " + HexDump.ToHex(subRecordData);
throw new RecordFormatException(msg);
}
_isPaddedToQuadByteMultiple = false;
}
}
else
{
_isPaddedToQuadByteMultiple = false;
}
_uninterpretedData = null;
}