Package org.apache.poi.hdgf.pointers

Examples of org.apache.poi.hdgf.pointers.Pointer


    ptr44d3.hasPointers = true;
    PointerContainingStream s44d3 = (PointerContainingStream)
      Stream.createStream(ptr44d3, contents, chunkFactory, ptrFactory);

    // Type: 0d  Addr: 014ff644  Offset: 4312  Len: 48  Format: 54  From: 44d3
    Pointer ptr4312 = s44d3.getChildPointers()[1];
    assertEquals(0x0d, ptr4312.getType());
    assertEquals(0x4312, ptr4312.getOffset());
    assertEquals(0x48, ptr4312.getLength());
    assertEquals(0x54, ptr4312.getFormat());
    assertTrue(ptr4312.destinationHasPointers());
    assertFalse(ptr4312.destinationHasStrings());

    PointerContainingStream s4312 = (PointerContainingStream)
      Stream.createStream(ptr4312, contents, chunkFactory, ptrFactory);

    // Check it has 0x347f
    // Type: 1f  Addr: 01540004  Offset: 347f  Len: 8e8  Format: 46  From: 4312
    assertEquals(2, s4312.getChildPointers().length);
    Pointer ptr347f = s4312.getChildPointers()[0];
    assertEquals(0x1f, ptr347f.getType());
    assertEquals(0x347f, ptr347f.getOffset());
    assertEquals(0x8e8, ptr347f.getLength());
    assertEquals(0x46, ptr347f.getFormat());
    assertFalse(ptr347f.destinationHasPointers());
    assertTrue(ptr347f.destinationHasStrings());

    // Find the children of 0x4312
    assertNull(s4312.getPointedToStreams());
    s4312.findChildren(contents);
    // Should have two, both strings
View Full Code Here


    assertTrue(s4312.getPointedToStreams()[0] instanceof StringsStream);
    assertTrue(s4312.getPointedToStreams()[1] instanceof StringsStream);
  }

  public void testTrailerContents() {
    Pointer trailerPtr = ptrFactory.createPointer(contents, trailerPointerAt);
    TrailerStream ts = (TrailerStream)
      Stream.createStream(trailerPtr, contents, chunkFactory, ptrFactory);

    assertNotNull(ts.getChildPointers());
    assertNull(ts.getPointedToStreams());
View Full Code Here

  }

  public void testChunkWithText() {
    // Parent ChunkStream is at 0x7194
    // This is one of the last children of the trailer
    Pointer trailerPtr = ptrFactory.createPointer(contents, trailerPointerAt);
    TrailerStream ts = (TrailerStream)
      Stream.createStream(trailerPtr, contents, chunkFactory, ptrFactory);

    ts.findChildren(contents);
View Full Code Here

    }
    String ind2 = ind  + "    ";
    String ind3 = ind2 + "    ";


    Pointer ptr = stream.getPointer();
    System.out.println(ind + "Stream at\t" + ptr.getOffset() +
        " - " + Integer.toHexString(ptr.getOffset()));
    System.out.println(ind + "  Type is\t" + ptr.getType() +
        " - " + Integer.toHexString(ptr.getType()));
    System.out.println(ind + "  Format is\t" + ptr.getFormat() +
        " - " + Integer.toHexString(ptr.getFormat()));
    System.out.println(ind + "  Length is\t" + ptr.getLength() +
        " - " + Integer.toHexString(ptr.getLength()));
    if(ptr.destinationCompressed()) {
      int decompLen = stream._getContentsLength();
      System.out.println(ind + "  DC.Length is\t" + decompLen +
          " - " + Integer.toHexString(decompLen));
    }
    System.out.println(ind + "  Compressed is\t" + ptr.destinationCompressed());
    System.out.println(ind + "  Stream is\t" + stream.getClass().getName());

    byte[] db = stream._getStore()._getContents();
    String ds = "";
    if(db.length >= 8) {
View Full Code Here

    System.err.println("Trailer has length " + trailerPointer.getLength());
    System.err.println("Trailer has format " + trailerPointer.getFormat());

    for(int i=0; i<trailer.getPointedToStreams().length; i++) {
      Stream stream = trailer.getPointedToStreams()[i];
      Pointer ptr = stream.getPointer();

      System.err.println("Looking at pointer " + i);
      System.err.println("\tType is " + ptr.getType() + "\t\t" + Integer.toHexString(ptr.getType()));
      System.err.println("\tOffset is " + ptr.getOffset() + "\t\t" + Long.toHexString(ptr.getOffset()));
      System.err.println("\tAddress is " + ptr.getAddress() + "\t" + Long.toHexString(ptr.getAddress()));
      System.err.println("\tLength is " + ptr.getLength() + "\t\t" + Long.toHexString(ptr.getLength()));
      System.err.println("\tFormat is " + ptr.getFormat() + "\t\t" + Long.toHexString(ptr.getFormat()));
      System.err.println("\tCompressed is " + ptr.destinationCompressed());
      System.err.println("\tStream is " + stream.getClass());

      if(stream instanceof PointerContainingStream) {
        PointerContainingStream pcs = (PointerContainingStream)stream;

        if(pcs.getPointedToStreams() != null && pcs.getPointedToStreams().length > 0) {
          System.err.println("\tContains " + pcs.getPointedToStreams().length + " other pointers/streams");
          for(int j=0; j<pcs.getPointedToStreams().length; j++) {
            Stream ss = pcs.getPointedToStreams()[j];
            Pointer sptr = ss.getPointer();
            System.err.println("\t\t" + j + " - Type is " + sptr.getType() + "\t\t" + Integer.toHexString(sptr.getType()));
            System.err.println("\t\t" + j + " - Length is " + sptr.getLength() + "\t\t" + Long.toHexString(sptr.getLength()));
          }
        }
      }

      if(stream instanceof StringsStream) {
View Full Code Here

   */
  public void findChildren(byte[] documentData) {
    // For each pointer, generate the Stream it points to
    childStreams = new Stream[childPointers.length];
    for(int i=0; i<childPointers.length; i++) {
      Pointer ptr = childPointers[i];
      childStreams[i] = Stream.createStream(ptr, documentData, chunkFactory, pointerFactory);

      // Process chunk streams into their chunks
      if(childStreams[i] instanceof ChunkStream) {
        ChunkStream child = (ChunkStream)childStreams[i];
View Full Code Here

    0, 0, 42, 1, 0, 0, 84, 0, 0, 0, 0, 0
  };

  public void testCompressedStream() {
    // Create a fake pointer
    Pointer ptr = new TestPointer(true, 0, compressedStream.length, -1, (short)-1);
    // Now the stream
    Stream stream = Stream.createStream(ptr, compressedStream, null, null);

    // Check
    assertNotNull(stream.getPointer());
View Full Code Here

    }
  }

  public void testUncompressedStream() {
    // Create a fake pointer
    Pointer ptr = new TestPointer(false, 0, uncompressedStream.length, -1, (short)-1);
    // Now the stream
    Stream stream = Stream.createStream(ptr, uncompressedStream, null, null);

    // Check
    assertNotNull(stream.getPointer());
View Full Code Here

    contents = new byte[docProps.getSize()];
    filesystem.createDocumentInputStream("VisioDocument").read(contents);
  }

  public void testGetTrailer() {
    Pointer trailerPointer = ptrFactory.createPointer(contents, 0x24);
    Stream.createStream(trailerPointer, contents, chunkFactory, ptrFactory);
  }
View Full Code Here

    int offsetA = 3708;
    int offsetB = 3744;
  }

  public void testGetChildren() {
    Pointer trailerPointer = ptrFactory.createPointer(contents, 0x24);
    TrailerStream trailer = (TrailerStream)
      Stream.createStream(trailerPointer, contents, chunkFactory, ptrFactory);

    // Get without recursing
    Pointer[] ptrs = trailer.getChildPointers();
View Full Code Here

TOP

Related Classes of org.apache.poi.hdgf.pointers.Pointer

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.