Package org.apache.poi.hdgf.pointers

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


    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


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

  public void testGetTrailer() throws Exception {
    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() throws Exception {
    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

  /**
   * Test creating the trailer, but not looking for children
   */
  public void testTrailer() {
    // Find the trailer
    Pointer trailerPtr = ptrFactory.createPointer(contents, trailerPointerAt);

    assertEquals(20, trailerPtr.getType());
    assertEquals(trailerDataAt, trailerPtr.getOffset());

    Stream stream = Stream.createStream(trailerPtr, contents, chunkFactory, ptrFactory);
    assertTrue(stream instanceof TrailerStream);
    TrailerStream ts = (TrailerStream)stream;

View Full Code Here

    assertEquals(0x17, ts.getChildPointers()[2].getType());
    assertEquals(0xff, ts.getChildPointers()[3].getType());
  }

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

    // Should be 7th one
    Pointer chunkPtr = ts.getChildPointers()[5];
    assertFalse(chunkPtr.destinationHasStrings());
    assertTrue(chunkPtr.destinationHasChunks());
    assertFalse(chunkPtr.destinationHasPointers());

    Stream stream = Stream.createStream(chunkPtr, contents, chunkFactory, ptrFactory);
    assertNotNull(stream);
    assertTrue(stream instanceof ChunkStream);
View Full Code Here

    ChunkStream cs = (ChunkStream)stream;
    cs.findChunks();
  }

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

    // Should be the 1st one
    Pointer stringPtr = ts.getChildPointers()[0];
    assertTrue(stringPtr.destinationHasStrings());
    assertFalse(stringPtr.destinationHasChunks());
    assertFalse(stringPtr.destinationHasPointers());

    Stream stream = Stream.createStream(stringPtr, contents, chunkFactory, ptrFactory);
    assertNotNull(stream);
    assertTrue(stream instanceof StringsStream);
  }
View Full Code Here

    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() throws Exception {
    // 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

   */
  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

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.