/** * Reads the ptg data from the array starting at the specified position * * @param data the RPN array * @param pos the current position in the array, excluding the ptg identifier * @return the number of bytes read */ public int read(byte[] data, int pos) { int length = data[pos] & 0xff; int consumed = 2; if ((data[pos+1] & 0x01) == 0) { value = StringHelper.getString(data, length, pos+2, settings); consumed += length; } else { value = StringHelper.getUnicodeString(data, length, pos+2); consumed += length * 2; } return consumed; }
/** * Reads the ptg data from the array starting at the specified position * * @param data the RPN array * @param pos the current position in the array, excluding the ptg identifier * @return the number of bytes read */ public int read(byte[] data, int pos) { int length = data[pos] & 0xff; int consumed = 2; if ((data[pos+1] & 0x01) == 0) { value = StringHelper.getString(data, length, pos+2, settings); consumed += length; } else { value = StringHelper.getUnicodeString(data, length, pos+2); consumed += length * 2; } return consumed; }
/** * Constructor * * @param t the raw bytes * @param isBiff8 Is record BIFF8 (else BIFF7) */ public WriteAccessRecord(Record t, boolean isBiff8, WorkbookSettings ws) { super(Type.WRITEACCESS); byte[] data = t.getData(); if (isBiff8) { wauser= StringHelper.getUnicodeString(data, 112/2, 0); } else { // BIFF7 does not use unicode encoding in string int length= data[1]; wauser= StringHelper.getString(data, length, 1, ws); } }
/** * Constructor * * @param t the raw bytes * @param isBiff8 Is record BIFF8 (else BIFF7) */ public WriteAccessRecord(Record t, boolean isBiff8, WorkbookSettings ws) { super(Type.WRITEACCESS); byte[] data = t.getData(); if (isBiff8) { wauser= StringHelper.getUnicodeString(data, 112/2, 0); } else { // BIFF7 does not use unicode encoding in string int length= data[1]; wauser= StringHelper.getString(data, length, 1, ws); } }
if (p.complex) p.stringValue = StringHelper.getUnicodeString(bytes, p.value / 2, pos); pos += p.value;
if (p.complex) p.stringValue = StringHelper.getUnicodeString(bytes, p.value / 2, pos); pos += p.value;
/** * Constructs this object from the raw data * * @param t the raw data * @param s the workbook settings */ public BoundsheetRecord(Record t, WorkbookSettings s) { super(t); byte[] data = getRecord().getData(); offset = IntegerHelper.getInt(data[0], data[1], data[2], data[3]); typeFlag = data[5]; visibilityFlag = data[4]; length = data[6]; if (data[7] == 0) { // Standard ASCII encoding byte[] bytes = new byte[length]; System.arraycopy(data, 8, bytes, 0, length); name = StringHelper.getString(bytes, length, 0, s); } else { // little endian Unicode encoding byte[] bytes = new byte[length * 2]; System.arraycopy(data, 8, bytes, 0, length * 2); name = StringHelper.getUnicodeString(bytes, length, 0); } }
/** * Constructs this object from the raw data * * @param t the raw data * @param s the workbook settings */ public BoundsheetRecord(Record t, WorkbookSettings s) { super(t); byte[] data = getRecord().getData(); offset = IntegerHelper.getInt(data[0], data[1], data[2], data[3]); typeFlag = data[5]; visibilityFlag = data[4]; length = data[6]; if (data[7] == 0) { // Standard ASCII encoding byte[] bytes = new byte[length]; System.arraycopy(data, 8, bytes, 0, length); name = StringHelper.getString(bytes, length, 0, s); } else { // little endian Unicode encoding byte[] bytes = new byte[length * 2]; System.arraycopy(data, 8, bytes, 0, length * 2); name = StringHelper.getUnicodeString(bytes, length, 0); } }
/** * Accessor for the text on the button * * @return the button text */ public String getText() { if (commentText == null) { Assert.verify(text != null); byte[] td = text.getData(); if (td[0] == 0) { commentText = StringHelper.getString (td, td.length - 1, 1, workbookSettings); } else { commentText = StringHelper.getUnicodeString (td, (td.length - 1) / 2, 1); } } return commentText; }
/** * Accessor for the comment text * * @return the comment text */ public String getText() { if (commentText == null) { Assert.verify(text != null); byte[] td = text.getData(); if (td[0] == 0) { commentText = StringHelper.getString (td, td.length - 1, 1, workbookSettings); } else { commentText = StringHelper.getUnicodeString (td, (td.length - 1) / 2, 1); } } return commentText; }
/** * Accessor for the comment text * * @return the comment text */ public String getText() { if (commentText == null) { Assert.verify(text != null); byte[] td = text.getData(); if (td[0] == 0) { commentText = StringHelper.getString (td, td.length - 1, 1, workbookSettings); } else { commentText = StringHelper.getUnicodeString (td, (td.length - 1) / 2, 1); } } return commentText; }
/** * Accessor for the text on the button * * @return the button text */ public String getText() { if (commentText == null) { Assert.verify(text != null); byte[] td = text.getData(); if (td[0] == 0) { commentText = StringHelper.getString (td, td.length - 1, 1, workbookSettings); } else { commentText = StringHelper.getUnicodeString (td, (td.length - 1) / 2, 1); } } return commentText; }
/** * Constructs this object from the raw data * * @param t the raw data * @param fr the formatting records * @param si the sheet * @param ws the workbook settings */ public LabelRecord(Record t, FormattingRecords fr, SheetImpl si, WorkbookSettings ws) { super(t, fr, si); byte[] data = getRecord().getData(); length = IntegerHelper.getInt(data[6], data[7]); if (data[8] == 0x0) { string = StringHelper.getString(data, length, 9, ws); } else { string = StringHelper.getUnicodeString(data, length, 9); } }
/** * Constructs this object from the raw data * * @param t the record data * @param ws the workbook settings */ FooterRecord(Record t, WorkbookSettings ws) { super(t); byte[] data = getRecord().getData(); if (data.length == 0) { return; } int chars = IntegerHelper.getInt(data[0], data[1]); boolean unicode = data[2] == 1; if (unicode) { footer = StringHelper.getUnicodeString(data, chars, 3); } else { footer = StringHelper.getString(data, chars, 3, ws); } }
/** * Constructs this object from the raw data * * @param t the raw data * @param fr the formatting records * @param si the sheet * @param ws the workbook settings */ public LabelRecord(Record t, FormattingRecords fr, SheetImpl si, WorkbookSettings ws) { super(t, fr, si); byte[] data = getRecord().getData(); length = IntegerHelper.getInt(data[6], data[7]); if (data[8] == 0x0) { string = StringHelper.getString(data, length, 9, ws); } else { string = StringHelper.getUnicodeString(data, length, 9); } }
/** * Constructs this object from the raw data * * @param t the record data * @param ws the workbook settings */ HeaderRecord(Record t, WorkbookSettings ws) { super(t); byte[] data = getRecord().getData(); if (data.length == 0) { return; } int chars = IntegerHelper.getInt(data[0], data[1]); boolean unicode = data[2] == 1; if (unicode) { header = StringHelper.getUnicodeString(data, chars, 3); } else { header = StringHelper.getString(data, chars, 3, ws); } }
/** * Constructs this object from the raw data * * @param t the record data * @param ws the workbook settings */ FooterRecord(Record t, WorkbookSettings ws) { super(t); byte[] data = getRecord().getData(); if (data.length == 0) { return; } int chars = IntegerHelper.getInt(data[0], data[1]); boolean unicode = data[2] == 1; if (unicode) { footer = StringHelper.getUnicodeString(data, chars, 3); } else { footer = StringHelper.getString(data, chars, 3, ws); } }
/** * Constructs this object from the raw data * * @param t the record data * @param ws the workbook settings */ HeaderRecord(Record t, WorkbookSettings ws) { super(t); byte[] data = getRecord().getData(); if (data.length == 0) { return; } int chars = IntegerHelper.getInt(data[0], data[1]); boolean unicode = data[2] == 1; if (unicode) { header = StringHelper.getUnicodeString(data, chars, 3); } else { header = StringHelper.getString(data, chars, 3, ws); } }
name = StringHelper.getUnicodeString(data, length, 8);
name = StringHelper.getUnicodeString(data, length, 8);