Examples of LittleEndianByteArrayOutputStream


Examples of org.apache.poi.util.LittleEndianByteArrayOutputStream

  /**
   * @deprecated use {@link #serialize(LittleEndianOutput)}
   */
  public int serialize(int offset, byte[] data) {
    serialize(new LittleEndianByteArrayOutputStream(data, offset, ENCODED_SIZE));
    return ENCODED_SIZE;
  }
View Full Code Here

Examples of org.apache.poi.util.LittleEndianByteArrayOutputStream

    assertEquals(new Double(0), values[1][0]);
    assertEquals(Boolean.FALSE, values[1][1]);
    assertEquals("FG", values[1][2]);

    byte[] outBuf = new byte[ENCODED_CONSTANT_DATA.length];
    ptg.writeTokenValueBytes(new LittleEndianByteArrayOutputStream(outBuf, 0));

    if(outBuf[0] == 4) {
      throw new AssertionFailedError("Identified bug 42564b");
    }
    assertTrue(Arrays.equals(ENCODED_CONSTANT_DATA, outBuf));
View Full Code Here

Examples of org.apache.poi.util.LittleEndianByteArrayOutputStream

    assertEquals(new Double(0), values[1][0]);
    assertEquals(Boolean.FALSE, values[1][1]);
    assertEquals("FG", values[1][2]);
   
    byte[] outBuf = new byte[ENCODED_CONSTANT_DATA.length];
    ptg.writeTokenValueBytes(new LittleEndianByteArrayOutputStream(outBuf, 0));
   
    if(outBuf[0] == 4) {
      throw new AssertionFailedError("Identified bug 42564b");
    }
    assertTrue(Arrays.equals(ENCODED_CONSTANT_DATA, outBuf));
View Full Code Here

Examples of org.apache.poi.util.LittleEndianByteArrayOutputStream

    g = GUID.parse("13579BDF-0246-8ACE-0123-456789ABCDEF");
    confirmGUID(g, 0x13579BDF, 0x0246, 0x8ACE, 0x0123456789ABCDEFL);
    assertEquals("13579BDF-0246-8ACE-0123-456789ABCDEF", g.formatAsString());

    byte[] buf = new byte[16];
    g.serialize(new LittleEndianByteArrayOutputStream(buf, 0));
    String expectedDump = "[DF, 9B, 57, 13, 46, 02, CE, 8A, 01, 23, 45, 67, 89, AB, CD, EF]";
    assertEquals(expectedDump, HexDump.toHex(buf));

    // STD Moniker
    g = createFromStreamDump("[D0, C9, EA, 79, F9, BA, CE, 11, 8C, 82, 00, AA, 00, 4B, A9, 0B]");
View Full Code Here

Examples of org.apache.poi.util.LittleEndianByteArrayOutputStream

    }

    @Test
    public void extRstEqualsAndHashCode() {
        byte buf[] = new byte[200];
        LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(buf, 0);
        String str = "\u1d02\u1d12\u1d22";
        bos.writeShort(1);
        bos.writeShort(5*LittleEndianConsts.SHORT_SIZE+str.length()*2+3*LittleEndianConsts.SHORT_SIZE+2); // data size
        bos.writeShort(0x4711);
        bos.writeShort(0x0815);
        bos.writeShort(1);
        bos.writeShort(str.length());
        bos.writeShort(str.length());
        StringUtil.putUnicodeLE(str, bos);
        bos.writeShort(1);
        bos.writeShort(1);
        bos.writeShort(3);
        bos.writeShort(42);
       
        LittleEndianInput in = new LittleEndianByteArrayInputStream(buf, 0, bos.getWriteIndex());
        UnicodeString.ExtRst extRst1 = new UnicodeString.ExtRst(in, bos.getWriteIndex());
        in = new LittleEndianByteArrayInputStream(buf, 0, bos.getWriteIndex());
        UnicodeString.ExtRst extRst2 = new UnicodeString.ExtRst(in, bos.getWriteIndex());
       
        assertEquals(extRst1, extRst2);
        assertEquals(extRst1.hashCode(), extRst2.hashCode());
    }
View Full Code Here

Examples of org.apache.poi.util.LittleEndianByteArrayOutputStream

  /**
   * @deprecated use {@link #serialize(LittleEndianOutput)}
   */
  public int serialize(int offset, byte[] data) {
    serialize(new LittleEndianByteArrayOutputStream(data, offset, ENCODED_SIZE));
    return ENCODED_SIZE;
  }
View Full Code Here

Examples of org.apache.poi.util.LittleEndianByteArrayOutputStream

    g = GUID.parse("13579BDF-0246-8ACE-0123-456789ABCDEF");
    confirmGUID(g, 0x13579BDF, 0x0246, 0x8ACE, 0x0123456789ABCDEFL);
    assertEquals("13579BDF-0246-8ACE-0123-456789ABCDEF", g.formatAsString());

    byte[] buf = new byte[16];
    g.serialize(new LittleEndianByteArrayOutputStream(buf, 0));
    String expectedDump = "[DF, 9B, 57, 13, 46, 02, CE, 8A, 01, 23, 45, 67, 89, AB, CD, EF]";
    assertEquals(expectedDump, HexDump.toHex(buf));

    // STD Moniker
    g = createFromStreamDump("[D0, C9, EA, 79, F9, BA, CE, 11, 8C, 82, 00, AA, 00, 4B, A9, 0B]");
View Full Code Here

Examples of org.apache.poi.util.LittleEndianByteArrayOutputStream

    assertEquals(new Double(0), values[1][0]);
    assertEquals(Boolean.FALSE, values[1][1]);
    assertEquals("FG", values[1][2]);

    byte[] outBuf = new byte[ENCODED_CONSTANT_DATA.length];
    ptg.writeTokenValueBytes(new LittleEndianByteArrayOutputStream(outBuf, 0));

    if(outBuf[0] == 4) {
      throw new AssertionFailedError("Identified bug 42564b");
    }
    assertArrayEquals(ENCODED_CONSTANT_DATA, outBuf);
View Full Code Here

Examples of org.apache.poi.util.LittleEndianByteArrayOutputStream

                ? (DirectoryEntry)dir.getEntry(parts[i])
                : dir.createDirectory(parts[i]);
        }
       
        final byte buf[] = new byte[5000];       
        LittleEndianByteArrayOutputStream bos = new LittleEndianByteArrayOutputStream(buf, 0);
        out.write(bos);
       
        String fileName = parts[parts.length-1];
       
        if (dir.hasEntry(fileName)) {
            dir.getEntry(fileName).delete();
        }
       
        return dir.createDocument(fileName, bos.getWriteIndex(), new POIFSWriterListener(){
            public void processPOIFSWriterEvent(POIFSWriterEvent event) {
                try {
                    event.getStream().write(buf, 0, event.getLimit());
                } catch (IOException e) {
                    throw new EncryptedDocumentException(e);
View Full Code Here

Examples of org.apache.poi.util.LittleEndianByteArrayOutputStream

        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        bos.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n".getBytes("UTF-8"));
        ed.save(bos, xo);

        final byte buf[] = new byte[5000];       
        LittleEndianByteArrayOutputStream leos = new LittleEndianByteArrayOutputStream(buf, 0);
        EncryptionInfo info = builder.getInfo();

        // EncryptionVersionInfo (4 bytes): A Version structure (section 2.1.4), where
        // Version.vMajor MUST be 0x0004 and Version.vMinor MUST be 0x0004
        leos.writeShort(info.getVersionMajor());
        leos.writeShort(info.getVersionMinor());
        // Reserved (4 bytes): A value that MUST be 0x00000040
        leos.writeInt(0x40);
        leos.write(bos.toByteArray());
       
        dir.createDocument("EncryptionInfo", leos.getWriteIndex(), new POIFSWriterListener() {
            public void processPOIFSWriterEvent(POIFSWriterEvent event) {
                try {
                    event.getStream().write(buf, 0, event.getLimit());
                } catch (IOException e) {
                    throw new EncryptedDocumentException(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.