Package org.apache.poi.hdgf.pointers

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


    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

    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

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.