public byte[] toByteArray() { byte[] result = new byte[LONG_SIZE]; LittleEndian.putLong( result, 0, fileTime); return result; }
FileMagic(long magic) { this.magic = new byte[1][8]; LittleEndian.putLong(this.magic[0], 0, magic); }
/** * write the value out to an array of bytes at the appropriate * offset * * @param data the array of bytes to which the value is to be * written * * @exception ArrayIndexOutOfBoundsException if the offset is out * of range */ public void writeToBytes(final byte [] data) throws ArrayIndexOutOfBoundsException { LittleEndian.putLong(data, _offset, _value); }
/** * put a double value into a byte array * * @param data * the byte array * @param offset * a starting offset into the byte array * @param value * the double (64-bit) value */ public static void putDouble( byte[] data, int offset, double value ) { putLong( data, offset, Double.doubleToLongBits( value ) ); }
/** * put a double value into a byte array * * @param value * the double (64-bit) value * @param outputStream * output stream * @throws IOException * if an I/O error occurs */ public static void putDouble( double value, OutputStream outputStream ) throws IOException { putLong( Double.doubleToLongBits( value ), outputStream ); }
@Override public byte[] getChecksum() { cacheProperties(); byte cs[] = new byte[LittleEndianConsts.LONG_SIZE]; LittleEndian.putLong(cs,0,checksum); return cs; }
/** * check if a picture with this picture data already exists in this presentation * * @param pictureData The picture data to find in the SlideShow * @return {@code null} if picture data is not found in this slideshow * @since 3.15 beta 2 */ @Override public XSLFPictureData findPictureData(byte[] pictureData) { long checksum = IOUtils.calculateChecksum(pictureData); byte cs[] = new byte[LittleEndianConsts.LONG_SIZE]; LittleEndian.putLong(cs, 0, checksum); for (XSLFPictureData pic : getPictureData()) { if (Arrays.equals(pic.getChecksum(), cs)) { return pic; } } return null; }
@Override public void processPOIFSWriterEvent(POIFSWriterEvent event) { try { try (OutputStream os = event.getStream(); FileInputStream fis = new FileInputStream(fileOut)) { // StreamSize (8 bytes): An unsigned integer that specifies the number of bytes used by data // encrypted within the EncryptedData field, not including the size of the StreamSize field. // Note that the actual size of the \EncryptedPackage stream (1) can be larger than this // value, depending on the block size of the chosen encryption algorithm byte buf[] = new byte[LittleEndianConsts.LONG_SIZE]; LittleEndian.putLong(buf, 0, pos); os.write(buf); IOUtils.copy(fis, os); } if (!fileOut.delete()) { LOG.log(POILogger.ERROR, "Can't delete temporary encryption file: "+fileOut); } } catch (IOException e) { throw new EncryptedDocumentException(e); } } }
LittleEndian.putLong( ((Number)value).longValue(), out); length = LittleEndianConsts.LONG_SIZE;
LittleEndian.putLong(buf, 0, oleStreamSize); integrityMD.update(buf, 0, LittleEndianConsts.LONG_SIZE);
public byte[] toByteArray() { byte[] result = new byte[LONG_SIZE]; LittleEndian.putLong( result, 0, fileTime); return result; }
FileMagic(long magic) { this.magic = new byte[1][8]; LittleEndian.putLong(this.magic[0], 0, magic); }
/** * <p>Writes a eight-byte value to an output stream.</p> * * @param out The stream to write to. * @param n The value to write. * @exception IOException if an I/O error occurs * @return The number of bytes written to the output stream. */ public static int writeToStream( final OutputStream out, final long n ) throws IOException { LittleEndian.putLong( n, out ); return LittleEndian.LONG_SIZE; }
public void setValue(long value) { if (data.length != 8) { data = new byte[8]; } LittleEndian.putLong(data, 0, value); } }
/** * write the value out to an array of bytes at the appropriate * offset * * @param data the array of bytes to which the value is to be * written * * @exception ArrayIndexOutOfBoundsException if the offset is out * of range */ public void writeToBytes(final byte [] data) throws ArrayIndexOutOfBoundsException { LittleEndian.putLong(data, _offset, _value); }
/** * write the value out to an array of bytes at the appropriate * offset * * @param data the array of bytes to which the value is to be * written * * @exception ArrayIndexOutOfBoundsException if the offset is out * of range */ public void writeToBytes(final byte [] data) throws ArrayIndexOutOfBoundsException { LittleEndian.putLong(data, _offset, _value); }
public void setValue(Calendar value) { if (data.length != 8) { data = new byte[8]; } long time = value.getTimeInMillis(); time = (time + OFFSET) * 10 * 1000; LittleEndian.putLong(data, 0, time); } }
/** * put a double value into a byte array * * @param value * the double (64-bit) value * @param outputStream * output stream * @throws IOException * if an I/O error occurs */ public static void putDouble( double value, OutputStream outputStream ) throws IOException { putLong( Double.doubleToLongBits( value ), outputStream ); }
public void setValue(BigInteger value) { if (data.length != 8) { data = new byte[8]; } long shifted = value.multiply(SHIFT).longValue(); LittleEndian.putLong(data, 0, shifted); } }
@Override public byte[] getChecksum() { cacheProperties(); byte cs[] = new byte[LittleEndianConsts.LONG_SIZE]; LittleEndian.putLong(cs,0,checksum); return cs; }