public int write( OutputStream out ) throws IOException { LittleEndian.putUInt( _value.length, out ); out.write( _value ); return LittleEndianConsts.INT_SIZE + _value.length; } }
public int write( OutputStream out ) throws IOException { LittleEndian.putUInt( _value.length / 2, out ); out.write( _value ); return LittleEndianConsts.INT_SIZE + _value.length; } }
/** * Writes the section's dictionary. * * @param out The output stream to write to. * @param codepage The codepage to be used to write the dictionary items. * @exception IOException if an I/O exception occurs. */ private void writeDictionary(final OutputStream out, final int codepage) throws IOException { final byte padding[] = new byte[4]; final Map<Long,String> dic = getDictionary(); LittleEndian.putUInt(dic.size(), out); int length = LittleEndianConsts.INT_SIZE; for (Map.Entry<Long,String> ls : dic.entrySet()) { LittleEndian.putUInt(ls.getKey(), out); length += LittleEndianConsts.INT_SIZE; final String value = ls.getValue()+"\0"; final byte bytes[] = CodePageUtil.getBytesInCodePage(value, codepage); final int len = (codepage == CodePageUtil.CP_UNICODE) ? value.length() : bytes.length; LittleEndian.putUInt( len, out ); length += LittleEndianConsts.INT_SIZE; out.write(bytes); length += bytes.length; final int pad = (codepage == CodePageUtil.CP_UNICODE) ? ((4 - (length & 0x3)) & 0x3) : 0; out.write(padding, 0, pad); length += pad; } final int pad = (4 - (length & 0x3)) & 0x3; out.write(padding, 0, pad); }
LittleEndian.putUInt(variantType, out); length += LittleEndianConsts.INT_SIZE; length += VariantSupport.write(out, variantType, getValue(), codepage);
protected static Cipher initCipherForBlock(Cipher cipher, int block, EncryptionInfo encryptionInfo, SecretKey skey, int encryptMode) throws GeneralSecurityException { EncryptionVerifier ver = encryptionInfo.getVerifier(); HashAlgorithm hashAlgo = ver.getHashAlgorithm(); byte blockKey[] = new byte[4]; LittleEndian.putUInt(blockKey, 0, block); byte encKey[] = CryptoFunctions.generateKey(skey.getEncoded(), hashAlgo, blockKey, 16); SecretKey key = new SecretKeySpec(encKey, skey.getAlgorithm()); if (cipher == null) { EncryptionHeader em = encryptionInfo.getHeader(); cipher = CryptoFunctions.getCipher(key, em.getCipherAlgorithm(), null, null, encryptMode); } else { cipher.init(encryptMode, key); } return cipher; }
protected static Cipher initCipherForBlock(Cipher cipher, int block, EncryptionInfo encryptionInfo, SecretKey skey, int encryptMode) throws GeneralSecurityException { EncryptionVerifier ver = encryptionInfo.getVerifier(); HashAlgorithm hashAlgo = ver.getHashAlgorithm(); byte blockKey[] = new byte[4]; LittleEndian.putUInt(blockKey, 0, block); MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo); hashAlg.update(skey.getEncoded()); byte encKey[] = hashAlg.digest(blockKey); EncryptionHeader header = encryptionInfo.getHeader(); int keyBits = header.getKeySize(); encKey = CryptoFunctions.getBlock0(encKey, keyBits / 8); if (keyBits == 40) { encKey = CryptoFunctions.getBlock0(encKey, 16); } SecretKey key = new SecretKeySpec(encKey, skey.getAlgorithm()); if (cipher == null) { cipher = CryptoFunctions.getCipher(key, header.getCipherAlgorithm(), null, null, encryptMode); } else { cipher.init(encryptMode, key); } return cipher; }
LittleEndian.putUInt(result, off[0], off[1]);
LittleEndian.putUInt(buf, 0, descList.size()); bos.write(buf, 0, 4); LittleEndian.putUInt(buf, 0, sde.streamOffset); bos.write(buf, 0, 4); LittleEndian.putUInt(buf, 0, sde.streamSize); bos.write(buf, 0, 4); LittleEndian.putUShort(buf, 0, sde.block); LittleEndian.putUByte(buf, 0, (short)sde.flags); bos.write(buf, 0, 1); LittleEndian.putUInt(buf, 0, sde.reserved2); bos.write(buf, 0, 4); byte nameBytes[] = StringUtil.getToUnicodeLE(sde.streamName); LittleEndian.putUInt(buf, 0, streamDescriptorArrayOffset); LittleEndian.putUInt(buf, 4, streamDescriptorArraySize);
/** * Constructs an empty atom - not yet supported */ private VBAInfoAtom() { _header = new byte[8]; // TODO: fix me LittleEndian.putUInt(_header, 0, _type); persistIdRef = 0; hasMacros = true; version = 2; }
public int write( OutputStream out ) throws IOException { LittleEndian.putUInt( _value.length / 2, out ); out.write( _value ); return LittleEndianConsts.INT_SIZE + _value.length; } }
/** * Write the contents of the record back, so it can be written * to disk * * @param out the output stream to write to. * @throws java.io.IOException if an error occurs. */ public void writeOut(OutputStream out) throws IOException { out.write(_header); LittleEndian.putUInt(persistIdRef, out); LittleEndian.putUInt(hasMacros ? 1 : 0, out); LittleEndian.putUInt(version, out); }
public int write( OutputStream out ) throws IOException { LittleEndian.putUInt( _value.length, out ); out.write( _value ); return LittleEndianConsts.INT_SIZE + _value.length; } }
/** * put an unsigned int value into beginning of a byte array * * @param data * the byte array * @param value * the int (32-bit) value * @deprecated Use {@link #putUInt(byte[], int, long)} instead */ @Deprecated public static void putUInt( byte[] data, long value ) { putUInt( data, 0, value ); }
/** * Write the contents of the record back, so it can be written * to disk */ public void writeOut(OutputStream out) throws IOException { out.write(_header); byte[] recdata = new byte[4]; LittleEndian.putUInt(recdata, 0, exObjIdRef); out.write(recdata); } }
/** * Constructs an empty atom, with a default run of size 1 */ public TextSpecInfoAtom() { _header = new byte[8]; LittleEndian.putUInt(_header, 4, _type); reset(1); }
public void serialize( byte[] data, int offset ) { LittleEndian.putShort(data, 0x0 + offset, field_1_info1); LittleEndian.putUInt(data, 0x2 + offset, field_2_rsid); LittleEndian.putShort(data, 0x6 + offset, field_3_info3); }
public void serialize( byte[] data, int offset ) { LittleEndian.putShort(data, 0x0 + offset, field_1_info1); LittleEndian.putUInt(data, 0x2 + offset, field_2_rsid); LittleEndian.putShort(data, 0x6 + offset, field_3_info3); }
public void serialize( byte[] data, int offset ) { LittleEndian.putUInt( data, 0x0 + offset, field_1_version ); LittleEndian.putShort( data, 0x4 + offset, field_2_bits ); LittleEndian.putUShort( data, 0x6 + offset, field_3_cch ); LittleEndian.putUShort( data, 0x8 + offset, field_4_hps ); }
public void writeListOverridesTo( HWPFOutputStream tableStream ) throws IOException { LittleEndian.putUInt( _overrideList.size(), tableStream ); for ( ListFormatOverride lfo : _overrideList ) { tableStream.write( lfo.getLfo().serialize() ); } for ( ListFormatOverride lfo : _overrideList ) { lfo.getLfoData().writeTo( tableStream ); } }