Package org.apache.poi.util

Examples of org.apache.poi.util.LittleEndianOutputStream


            // TODO: any properties???
        }
   
        public void processPOIFSWriterEvent(POIFSWriterEvent event) {
            try {
                LittleEndianOutputStream leos = new LittleEndianOutputStream(event.getStream());

                // 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
                leos.writeLong(_pos);

                FileInputStream fis = new FileInputStream(fileOut);
                IOUtils.copy(fis, leos);
                fis.close();
                fileOut.delete();

                leos.close();
            } catch (IOException e) {
                throw new EncryptedDocumentException(e);
            }
        }
View Full Code Here


      throw new RuntimeException(e);
    }

    md5.update(_keyDigest);
    ByteArrayOutputStream baos = new ByteArrayOutputStream(4);
    new LittleEndianOutputStream(baos).writeInt(keyBlockNo);
    md5.update(baos.toByteArray());

    byte[] digest = md5.digest();
    return new RC4(digest);
  }
View Full Code Here

   */
  protected abstract int getDataSize();
  public byte[] serialize() {
    int size = getDataSize() + 4;
    ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
    serialize(new LittleEndianOutputStream(baos));
    if (baos.size() != size) {
      throw new RuntimeException("write size mismatch");
    }
    return baos.toByteArray();
  }
View Full Code Here

        LittleEndianInputStream in = new LittleEndianInputStream(new ByteArrayInputStream(data));

        LbsDataSubRecord.LbsDropData lbs = new LbsDataSubRecord.LbsDropData(in);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        lbs.serialize(new LittleEndianOutputStream(baos));

        assertTrue(Arrays.equals(data, baos.toByteArray()));
    }
View Full Code Here

    private void testReadWrite(byte[] data, String message) throws IOException
    {
        RecordInputStream is = TestcaseRecordInputStream.create(81, data);
        DConRefRecord d = new DConRefRecord(is);
        ByteArrayOutputStream bos = new ByteArrayOutputStream(data.length);
        LittleEndianOutputStream o = new LittleEndianOutputStream(bos);
        d.serialize(o);
        o.flush();

        assertTrue(message, Arrays.equals(data,
                bos.toByteArray()));
    }
View Full Code Here

{
   CellRangeAddress ref = new CellRangeAddress(0,0,0,0);
 
  byte[] recordBytes;
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  LittleEndianOutputStream out = new LittleEndianOutputStream(baos);
 
  // With nothing set
  ref.serialize(out);
  recordBytes = baos.toByteArray();
    assertEquals(recordBytes.length, data.length);
View Full Code Here

        LittleEndianInputStream in = new LittleEndianInputStream(new ByteArrayInputStream(data));

        LbsDataSubRecord.LbsDropData lbs = new LbsDataSubRecord.LbsDropData(in);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        lbs.serialize(new LittleEndianOutputStream(baos));

        assertTrue(Arrays.equals(data, baos.toByteArray()));
    }
View Full Code Here

       FormatRun fr = new FormatRun((short)4, (short)0x15c);
       assertEquals(4, fr.getCharacterPos());
       assertEquals(0x15c, fr.getFontIndex());
      
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
       LittleEndianOutputStream out = new LittleEndianOutputStream(baos);
      
       fr.serialize(out);
      
       byte[] b = baos.toByteArray();
       assertEquals(4, b.length);
View Full Code Here

       assertEquals("", ext.getPhoneticText());
       assertEquals(0, ext.getPhRuns().length);
       assertEquals(10, ext.getDataSize()); // Excludes 4 byte header
      
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
       LittleEndianOutputStream out = new LittleEndianOutputStream(baos);
       ContinuableRecordOutput cout = new ContinuableRecordOutput(out, 0xffff);
      
       ext.serialize(cout);
       cout.writeContinue();
      
View Full Code Here

   */
  protected abstract int getDataSize();
  public byte[] serialize() {
    int size = getDataSize() + 4;
    ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
    serialize(new LittleEndianOutputStream(baos));
    if (baos.size() != size) {
      throw new RuntimeException("write size mismatch");
    }
    return baos.toByteArray();
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.util.LittleEndianOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.