Examples of StringChunk


Examples of org.apache.poi.hsmf.datatypes.StringChunk

*/
public final class TestChunkData extends TestCase {
  private Chunks chunks = Chunks.getInstance(false);

  public void testChunkCreate() {
    StringChunk chunk = new StringChunk(0x0200, false);
    TestCase.assertEquals("__substg1.0_0200001E", chunk.getEntryName());

    /* test the lower and upper limits of the chunk ids */
    chunk = new StringChunk(0x0000, false);
    TestCase.assertEquals("__substg1.0_0000001E", chunk.getEntryName());

    chunk = new StringChunk(0xFFFF, false);
    TestCase.assertEquals("__substg1.0_FFFF001E", chunk.getEntryName());

    chunk = new StringChunk(0xFFFF, true);
    TestCase.assertEquals("__substg1.0_FFFF001F", chunk.getEntryName());
  }
View Full Code Here

Examples of org.apache.poi.hsmf.datatypes.StringChunk

   * @param chunk
   * @throws ChunkNotFoundException
   */
  public String getStringFromChunk(StringChunk chunk) throws ChunkNotFoundException {
    Chunk out = this.chunkParser.getDocumentNode(chunk);
    StringChunk strchunk = (StringChunk)out;
    return strchunk.toString();
  }
View Full Code Here

Examples of org.apache.poi.hsmf.datatypes.StringChunk

   * @return
   * @throws ChunkNotFoundException
   */
  public String getStringFromChunk(StringChunk chunk) throws ChunkNotFoundException {
    Chunk out = this.chunkParser.getDocumentNode(chunk);
    StringChunk strchunk = (StringChunk)out;
    return strchunk.toString();
  }
View Full Code Here

Examples of org.apache.poi.hsmf.datatypes.StringChunk

            case Types.BINARY:
               chunk = new ByteChunk(namePrefix, chunkId, type);
               break;
            case Types.ASCII_STRING:
            case Types.UNICODE_STRING:
               chunk = new StringChunk(namePrefix, chunkId, type);
               break;
            }
         }
        
         if(chunk != null) {
View Full Code Here

Examples of org.apache.poi.hsmf.datatypes.StringChunk

                 // There's normally something in the headers
                 msg.guess7BitEncoding();
              } else {
                 // Nothing in the header, try encoding detection
                 //  on the message body
                 StringChunk text = msg.getMainChunks().textBodyChunk;
                 if(text != null) {
                    CharsetDetector detector = new CharsetDetector();
                    detector.setText( text.getRawValue() );
                    CharsetMatch match = detector.detect();
                    if(match.getConfidence() > 35) {
                       msg.set7BitEncoding( match.getName() );
                    }
                 }
View Full Code Here

Examples of org.apache.poi.hsmf.datatypes.StringChunk

            new FileInputStream(samples.getFile("quick.msg"))
      );
     
      // Check a few core things are present
      simple.getRoot().getEntry(
            (new StringChunk(MAPIProperty.SUBJECT.id, Types.ASCII_STRING)).getEntryName()
      );
      simple.getRoot().getEntry(
            (new StringChunk(MAPIProperty.SENDER_NAME.id, Types.ASCII_STRING)).getEntryName()
      );
     
      // Now load the file
      MAPIMessage msg = new MAPIMessage(simple);
      try {
View Full Code Here

Examples of org.apache.poi.hsmf.datatypes.StringChunk

                   chunk = new DirectoryChunk((DirectoryNode)entry, namePrefix, chunkId, type);
               }
               break;
            case Types.ASCII_STRING:
            case Types.UNICODE_STRING:
               chunk = new StringChunk(namePrefix, chunkId, type);
               break;
            }
         }
        
         if(chunk != null) {
View Full Code Here

Examples of org.apache.poi.hsmf.datatypes.StringChunk

            new FileInputStream(samples.getFile("quick.msg"))
      );
     
      // Check a few core things are present
      simple.getRoot().getEntry(
            (new StringChunk(MAPIProperty.SUBJECT.id, Types.ASCII_STRING)).getEntryName()
      );
      simple.getRoot().getEntry(
            (new StringChunk(MAPIProperty.SENDER_NAME.id, Types.ASCII_STRING)).getEntryName()
      );
     
      // Now load the file
      MAPIMessage msg = new MAPIMessage(simple);
      try {
View Full Code Here

Examples of org.apache.poi.hsmf.datatypes.StringChunk

                      chunk = new DirectoryChunk((DirectoryNode)entry, namePrefix, chunkId, type);
                  }
               }
               else if (type == Types.ASCII_STRING ||
                        type == Types.UNICODE_STRING) {
                  chunk = new StringChunk(namePrefix, chunkId, type);
               }
               else {
                  // Type of an unsupported type! Skipping...
               }
            }
View Full Code Here

Examples of org.apache.poi.hsmf.datatypes.StringChunk

*/
public final class TestChunkData extends TestCase {
  public void testChunkCreate() {
     Chunk chunk;
    
    chunk = new StringChunk(0x0200, 0x001E);
    assertEquals("__substg1.0_0200001E", chunk.getEntryName());
    assertEquals(0x0200, chunk.getChunkId());
    assertEquals(0x001E, chunk.getType());

      chunk = new StringChunk("__substg1.0_", 0x0200, 0x001E);
      assertEquals("__substg1.0_0200001E", chunk.getEntryName());
      assertEquals(0x0200, chunk.getChunkId());
      assertEquals(0x001E, chunk.getType());
     
    /* test the lower and upper limits of the chunk ids */
    chunk = new StringChunk(0x0000, 0x001E);
    assertEquals("__substg1.0_0000001E", chunk.getEntryName());

    chunk = new StringChunk(0xFFFF, 0x001E);
    assertEquals("__substg1.0_FFFF001E", chunk.getEntryName());

    chunk = new StringChunk(0xFFFF, 0x001F);
    assertEquals("__substg1.0_FFFF001F", chunk.getEntryName());
  }
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.