/** * Constructor * * @param dg the escher stream data * @param p the current position in the stream */ public EscherRecordData(EscherStream dg, int p) { escherStream = dg; pos = p; byte[] data = escherStream.getData(); streamLength = data.Length; // First two bytes contain instance and version int value = IntegerHelper.getInt(data[pos], data[pos + 1]); // Instance value is the first 12 bits instance = (value & 0xfff0) >> 4; // Version is the last four bits version = value & 0xf; // Bytes 2 and 3 are the record id recordId = IntegerHelper.getInt(data[pos + 2], data[pos + 3]); // Length is bytes 4,5,6 and 7 length = IntegerHelper.getInt(data[pos + 4], data[pos + 5], data[pos + 6], data[pos + 7]); if (version == 0x0f) { container = true; } else { container = false; } }
/** * Gets the data that was read in, excluding the header data * * @return the value data that was read in */ public byte[] getBytes() { byte[] d = new byte[length]; System.Array.Copy(escherStream.getData(), pos + 8, d, 0, length); return(d); }
/** * Constructor * * @param dg the escher stream data * @param p the current position in the stream */ public EscherRecordData(EscherStream dg,int p) { escherStream = dg; pos = p; byte[] data = escherStream.getData(); streamLength = data.Length; // First two bytes contain instance and version int value = IntegerHelper.getInt(data[pos],data[pos + 1]); // Instance value is the first 12 bits instance = (value & 0xfff0) >> 4; // Version is the last four bits version = value & 0xf; // Bytes 2 and 3 are the record id recordId = IntegerHelper.getInt(data[pos + 2],data[pos + 3]); // Length is bytes 4,5,6 and 7 length = IntegerHelper.getInt(data[pos + 4],data[pos + 5], data[pos + 6],data[pos + 7]); if (version == 0x0f) { container = true; } else { container = false; } }