Package org.apache.poi.hdgf.chunks

Examples of org.apache.poi.hdgf.chunks.Chunk


    }
    assertTrue(hasText);
    // Which is the 72nd command
    assertEquals("Text", cs.getChunks()[72].getName());

    Chunk text = cs.getChunks()[72];
    assertEquals("Text", text.getName());

    // Which contains our text
    assertEquals(1, text.getCommands().length);
    assertEquals("Test View\n", text.getCommands()[0].getValue());


    // Almost at the end is some more text
    assertEquals("Text", cs.getChunks()[128].getName());
    text = cs.getChunks()[128];
    assertEquals("Text", text.getName());

    assertEquals(1, text.getCommands().length);
    assertEquals("Some random text, on a page\n", text.getCommands()[0].getValue());
  }
View Full Code Here


      }
    }
    if(stream instanceof ChunkStream) {
      ChunkStream cs = (ChunkStream)stream;
      for(int i=0; i<cs.getChunks().length; i++) {
        Chunk chunk = cs.getChunks()[i];
        if(chunk != null &&
            chunk.getName() != null &&
            chunk.getName().equals("Text") &&
            chunk.getCommands().length > 0) {
          // First command
          Command cmd = chunk.getCommands()[0];
          if(cmd != null && cmd.getValue() != null) {
            text.add( cmd.getValue().toString() );
          }
        }
      }
View Full Code Here

    byte[] contents = getStore().getContents();
    while(pos < contents.length) {
      // Ensure we have enough data to create a chunk from
      int headerSize = ChunkHeader.getHeaderSize(chunkFactory.getVersion());
      if(pos+headerSize <= contents.length) {
        Chunk chunk = chunkFactory.createChunk(contents, pos);
        chunksA.add(chunk);
       
        pos += chunk.getOnDiskSize();
      } else {
        System.err.println("Needed " + headerSize + " bytes to create the next chunk header, but only found " + (contents.length-pos) + " bytes, ignoring rest of data");
        pos = contents.length;
      }
    }
View Full Code Here

    }
    assertTrue(hasText);
    // Which is the 72nd command
    assertEquals("Text", cs.getChunks()[72].getName());
   
    Chunk text = cs.getChunks()[72];
    assertEquals("Text", text.getName());
   
    // Which contains our text
    assertEquals(1, text.getCommands().length);
    assertEquals("Test View\n", text.getCommands()[0].getValue());
   
   
    // Almost at the end is some more text
    assertEquals("Text", cs.getChunks()[128].getName());
    text = cs.getChunks()[128];
    assertEquals("Text", text.getName());
   
    assertEquals(1, text.getCommands().length);
    assertEquals("Some random text, on a page\n", text.getCommands()[0].getValue());
  }
View Full Code Here

    byte[] contents = getStore().getContents();
    while(pos < contents.length) {
      // Ensure we have enough data to create a chunk from
      int headerSize = ChunkHeader.getHeaderSize(chunkFactory.getVersion());
      if(pos+headerSize <= contents.length) {
        Chunk chunk = chunkFactory.createChunk(contents, pos);
        chunksA.add(chunk);

        pos += chunk.getOnDiskSize();
      } else {
        System.err.println("Needed " + headerSize + " bytes to create the next chunk header, but only found " + (contents.length-pos) + " bytes, ignoring rest of data");
        pos = contents.length;
      }
    }
View Full Code Here

      ChunkStream cs = (ChunkStream)stream;
      System.out.println(ind + "  Has " + cs.getChunks().length +
          " chunks:");
     
      for(int i=0; i<cs.getChunks().length; i++) {
        Chunk chunk = cs.getChunks()[i];
        System.out.println(ind2 + "" + chunk.getName());
        System.out.println(ind2 + "  Length is " + chunk._getContents().length + " (" + Integer.toHexString(chunk._getContents().length) + ")");
        System.out.println(ind2 + "  OD Size is " + chunk.getOnDiskSize() + " (" + Integer.toHexString(chunk.getOnDiskSize()) + ")");
        System.out.println(ind2 + "  T / S is " + chunk.getTrailer() + " / " + chunk.getSeparator());
        System.out.println(ind2 + "  Holds " + chunk.getCommands().length + " commands");
        for(int j=0; j<chunk.getCommands().length; j++) {
          Command command = chunk.getCommands()[j];
          System.out.println(ind3 + "" +
              command.getDefinition().getName() +
              " " + command.getValue()
          );
        }
View Full Code Here

      }
    }
    if(stream instanceof ChunkStream) {
      ChunkStream cs = (ChunkStream)stream;
      for(int i=0; i<cs.getChunks().length; i++) {
        Chunk chunk = cs.getChunks()[i];
        if(chunk != null &&
            chunk.getName() != null &&
            chunk.getName().equals("Text") &&
            chunk.getCommands().length > 0) {
          // First command
          Command cmd = chunk.getCommands()[0];
          if(cmd != null && cmd.getValue() != null) {
            text.add( cmd.getValue().toString() );
          }
        }
      }
View Full Code Here

      }
    }
    if(stream instanceof ChunkStream) {
      ChunkStream cs = (ChunkStream)stream;
      for(int i=0; i<cs.getChunks().length; i++) {
        Chunk chunk = cs.getChunks()[i];
        if(chunk != null &&
            chunk.getName() != null &&
            chunk.getName().equals("Text") &&
            chunk.getCommands().length > 0) {
          // First command
          Command cmd = chunk.getCommands()[0];
          if(cmd != null && cmd.getValue() != null) {
            text.add( cmd.getValue().toString() );
          }
        }
      }
View Full Code Here

    }
   
    int pos = 0;
    byte[] contents = getStore().getContents();
    while(pos < contents.length) {
      Chunk chunk = chunkFactory.createChunk(contents, pos);
      chunksA.add(chunk);
     
      pos += chunk.getOnDiskSize();
    }
   
    chunks = (Chunk[])chunksA.toArray(new Chunk[chunksA.size()]);
  }
View Full Code Here

    byte[] contents = getStore().getContents();
    while(pos < contents.length) {
      // Ensure we have enough data to create a chunk from
      int headerSize = ChunkHeader.getHeaderSize(chunkFactory.getVersion());
      if(pos+headerSize <= contents.length) {
        Chunk chunk = chunkFactory.createChunk(contents, pos);
        chunksA.add(chunk);

        pos += chunk.getOnDiskSize();
      } else {
        System.err.println("Needed " + headerSize + " bytes to create the next chunk header, but only found " + (contents.length-pos) + " bytes, ignoring rest of data");
        pos = contents.length;
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.hdgf.chunks.Chunk

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.