LittleEndianByteArrayInputStream leis = new LittleEndianByteArrayInputStream(src, offFix); int size = (int)Math.min(leis.readUInt(), src.length-_offset); final int propertyCount = (int)leis.readUInt(); for (int i = 0; i < propertyCount; i++) { long id = (int)leis.readUInt(); long off = (int)leis.readUInt(); if (cpOffset != null) { leis.setReadIndex((int)(this._offset + cpOffset)); final long type = leis.readUInt(); codepage = leis.readUShort(); setCodepage(codepage); leis.setReadIndex((int)(this._offset + off)); leis.mark(100000); if (!readDictionary(leis, pLen, codepage)) { leis.reset(); try {
@Override public long readLong() { final int size = LittleEndianConsts.LONG_SIZE; checkPosition(size); long le = LittleEndian.getLong(buf, pos); long skipped = super.skip(size); assert skipped == size : "Buffer overrun"; return le; }
LittleEndianByteArrayInputStream leis = new LittleEndianByteArrayInputStream(src, offset, length); final int byteOrder = leis.readUShort(); if (byteOrder != BYTE_ORDER_ASSERTION) { return false; final int format = leis.readUShort(); if (format != FORMAT_ASSERTION) { return false; final long osVersion = leis.readUInt(); byte[] clsBuf = new byte[ClassID.LENGTH]; leis.readFully(clsBuf); final long sectionCount = leis.readUInt(); return (sectionCount >= 0); } catch (RuntimeException e) {
@Override public void readFully(byte[] buffer, int off, int len) { checkPosition(len); read(buffer, off, len); }
_value = lei.readByte(); break; _value = lei.readUByte(); break; _value = lei.readShort(); break; _value = lei.readUShort(); break; _value = lei.readInt(); break; case Variant.VT_UI4: case Variant.VT_ERROR: _value = lei.readUInt(); break; _value = lei.readLong(); break; lei.readFully(biBytesLE); _value = Float.intBitsToFloat(lei.readInt()); break; _value = lei.readDouble();
public Ptg[] getTokens() { LittleEndianInput in = new LittleEndianByteArrayInputStream(_byteEncoding); return Ptg.readTokens(_encodedTokenLen, in); } /**
public void read( LittleEndianByteArrayInputStream lei ) { int offset = lei.getReadIndex(); int size = lei.readInt(); if ( size < 4 ) { String msg = "ClipboardData at offset "+offset+" size less than 4 bytes "+ "(doesn't even have format field!). Setting to format == 0 and hope for the best"; LOG.log( POILogger.WARN, msg); _format = 0; _value = new byte[0]; return; } _format = lei.readInt(); _value = IOUtils.safelyAllocate(size - LittleEndianConsts.INT_SIZE, MAX_RECORD_LENGTH); lei.readFully(_value); }
LittleEndianByteArrayInputStream plain = new LittleEndianByteArrayInputStream(buf, 0); // NOSONAR LittleEndianByteArrayOutputStream leos = new LittleEndianByteArrayOutputStream(buf, 0); // NOSONAR enc.setChunkSize(Biff8DecryptingStream.RC4_REKEYING_INTERVAL); plain.readFully(bsrBuf); os.writePlain(bsrBuf, 0, 4); os.write(bsrBuf, 4, len-4); while (todo > 0) { int nextLen = Math.min(todo, tmp.length); plain.readFully(tmp, 0, nextLen); if (isPlain) { os.writePlain(tmp, 0, nextLen);
public long getD4() { // ByteArrayOutputStream baos = new ByteArrayOutputStream(8); try { new DataOutputStream(baos).writeLong(_d4); } catch (IOException e) { throw new RuntimeException(e); } byte[] buf = baos.toByteArray(); return new LittleEndianByteArrayInputStream(buf).readLong(); }
LittleEndianByteArrayInputStream subRecStream = new LittleEndianByteArrayInputStream(subRecordData); CommonObjectDataSubRecord cmo = (CommonObjectDataSubRecord)SubRecord.createSubRecord(subRecStream, 0); subrecords.add(cmo); final int nRemainingBytes = subRecordData.length-subRecStream.getReadIndex(); if (nRemainingBytes > 0) {
@Override public void readPlain(byte[] buf, int off, int len) { readFully(buf, off, len); } }
static void skipPadding( LittleEndianByteArrayInputStream lei ) { final int offset = lei.getReadIndex(); int skipBytes = (4 - (offset & 3)) & 3; for (int i=0; i<skipBytes; i++) { lei.mark(1); int b = lei.read(); if (b == -1 || b != 0) { lei.reset(); break; } } } }
public static Object read( LittleEndianByteArrayInputStream lei, final int length, final long type, final int codepage ) throws ReadingNotSupportedException, UnsupportedEncodingException { final int offset = lei.getReadIndex(); TypedPropertyValue typedPropertyValue = new TypedPropertyValue( (int) type, null ); try { final int unpadded = lei.getReadIndex()-offset; lei.setReadIndex(offset); final byte[] v = IOUtils.safelyAllocate(unpadded, MAX_RECORD_LENGTH); lei.readFully( v, 0, unpadded ); throw new ReadingNotSupportedException( type, v );
public TextSpecInfoRun(LittleEndianByteArrayInputStream source) { length = source.readInt(); mask = source.readInt(); if (spellFld.isSet(mask)) { spellInfo = source.readShort(); } if (langFld.isSet(mask)) { langId = source.readShort(); } if (altLangFld.isSet(mask)) { altLangId = source.readShort(); } if (bidiFld.isSet(mask)) { bidi = source.readShort(); } if (pp10extFld.isSet(mask)) { pp10extMask = source.readInt(); } if (smartTagFld.isSet(mask)) { // An unsigned integer specifies the count of items in rgSmartTagIndex. int count = source.readInt(); smartTagsBytes = IOUtils.safelyAllocate(4+count*4, MAX_RECORD_LENGTH); LittleEndian.putInt(smartTagsBytes, 0, count); // An array of SmartTagIndex that specifies the indices. // The count of items in the array is specified by count. source.readFully(smartTagsBytes, 4, count*4); } }
public void read( LittleEndianByteArrayInputStream lei ) { fileTime = lei.readLong(); }
private void decryptPicBytes(byte[] pictstream, int offset, int len) throws IOException, GeneralSecurityException { // when reading the picture elements, each time a segment is read, the cipher needs // to be reset (usually done when calling Cipher.doFinal) LittleEndianByteArrayInputStream lei = new LittleEndianByteArrayInputStream(pictstream, offset); Decryptor dec = getEncryptionInfo().getDecryptor(); ChunkedCipherInputStream ccis = (ChunkedCipherInputStream)dec.getDataStream(lei, len, 0); readFully(ccis, pictstream, offset, len); ccis.close(); lei.close(); }
public void read( LittleEndianByteArrayInputStream lei ) { _type = lei.readShort(); short padding = lei.readShort(); if ( padding != 0 ) { LOG.log( POILogger.WARN, "TypedPropertyValue padding at offset " + lei.getReadIndex() + " MUST be 0, but it's value is " + padding ); } readValue( lei ); }