当前位置: 首页>>代码示例>>Java>>正文


Java SummaryInformation类代码示例

本文整理汇总了Java中org.apache.poi.hpsf.SummaryInformation的典型用法代码示例。如果您正苦于以下问题:Java SummaryInformation类的具体用法?Java SummaryInformation怎么用?Java SummaryInformation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SummaryInformation类属于org.apache.poi.hpsf包,在下文中一共展示了SummaryInformation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test1

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
@Test
void test1() {
    // Test an invalid stream, should be ignored
    Entry entry = mock(Entry.class);
    doReturn("\005RandomString").when(entry).getName();
    assertTrue(instance.test(entry));
    verify(instance, never()).sanitizeSummaryInformation(eq(session), (DocumentEntry) any());

    // Test a valid stream name, but wrong type (should be ignored)
    reset(entry);
    doReturn(SummaryInformation.DEFAULT_STREAM_NAME).when(entry).getName();
    assertTrue(instance.test(entry));
    verify(instance, never()).sanitizeSummaryInformation(eq(session), (DocumentEntry) any());

    reset(instance, entry);

    // Test a valid SummaryInformation name
    DocumentEntry docEntry = mock(DocumentEntry.class);

    doReturn(SummaryInformation.DEFAULT_STREAM_NAME).when(docEntry).getName();
    doNothing().when(instance).sanitizeSummaryInformation(session, docEntry);
    assertTrue(instance.test(docEntry));
    verify(instance, atLeastOnce()).sanitizeSummaryInformation(session, docEntry);
}
 
开发者ID:docbleach,项目名称:DocBleach,代码行数:25,代码来源:SummaryInformationSanitiserTest.java

示例2: main

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
	HWPFDocument doc = new HWPFDocument(new FileInputStream(
			"data/document.doc"));
	SummaryInformation summaryInfo = doc.getSummaryInformation();
	System.out.println(summaryInfo.getApplicationName());
	System.out.println(summaryInfo.getAuthor());
	System.out.println(summaryInfo.getComments());
	System.out.println(summaryInfo.getCharCount());
	System.out.println(summaryInfo.getEditTime());
	System.out.println(summaryInfo.getKeywords());
	System.out.println(summaryInfo.getLastAuthor());
	System.out.println(summaryInfo.getPageCount());
	System.out.println(summaryInfo.getRevNumber());
	System.out.println(summaryInfo.getSecurity());
	System.out.println(summaryInfo.getSubject());
	System.out.println(summaryInfo.getTemplate());
}
 
开发者ID:asposemarketplace,项目名称:Aspose_for_Apache_POI,代码行数:19,代码来源:ApacheDocumentProperties.java

示例3: main

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
public static void main(String[] args) throws Exception
{
	String dataPath = "src/featurescomparison/workingwithdocuments/getdocumentproperties/data/";
	
	HWPFDocument doc = new HWPFDocument(new FileInputStream(
			dataPath + "document.doc"));
	SummaryInformation summaryInfo = doc.getSummaryInformation();
	System.out.println(summaryInfo.getApplicationName());
	System.out.println(summaryInfo.getAuthor());
	System.out.println(summaryInfo.getComments());
	System.out.println(summaryInfo.getCharCount());
	System.out.println(summaryInfo.getEditTime());
	System.out.println(summaryInfo.getKeywords());
	System.out.println(summaryInfo.getLastAuthor());
	System.out.println(summaryInfo.getPageCount());
	System.out.println(summaryInfo.getRevNumber());
	System.out.println(summaryInfo.getSecurity());
	System.out.println(summaryInfo.getSubject());
	System.out.println(summaryInfo.getTemplate());
}
 
开发者ID:asposemarketplace,项目名称:Aspose_Words_for_Apache_POI,代码行数:21,代码来源:ApacheDocumentProperties.java

示例4: getAuthor

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
private static String getAuthor(Workbook wb) {
	if (HSSFWorkbook.class.isInstance(wb)) {
		HSSFWorkbook hssf = (HSSFWorkbook) wb;
		SummaryInformation info = hssf.getSummaryInformation();
		if (info != null) {
			return info.getAuthor();
		}
	} else if (XSSFWorkbook.class.isInstance(wb)) {
		XSSFWorkbook xssf = (XSSFWorkbook) wb;
		POIXMLProperties xmlProps = xssf.getProperties();
		if (xmlProps != null) {
			POIXMLProperties.CoreProperties coreProps = xmlProps.getCoreProperties();
			if (coreProps != null) {
				return coreProps.getCreator();
			}
		}
	}
	return null;
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:20,代码来源:PoiIO.java

示例5: processDocumentInformation

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
@Override
protected void processDocumentInformation(
        SummaryInformation summaryInformation )
{
    if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getTitle() ) )
        foDocumentFacade.setTitle( summaryInformation.getTitle() );

    if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getAuthor() ) )
        foDocumentFacade.setCreator( summaryInformation.getAuthor() );

    if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getKeywords() ) )
        foDocumentFacade.setKeywords( summaryInformation.getKeywords() );

    if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getComments() ) )
        foDocumentFacade.setDescription( summaryInformation.getComments() );
}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:17,代码来源:WordToFoConverter.java

示例6: processDocumentInformation

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
@Override
protected void processDocumentInformation(
        SummaryInformation summaryInformation )
{
    if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getTitle() ) )
        htmlDocumentFacade.setTitle( summaryInformation.getTitle() );

    if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getAuthor() ) )
        htmlDocumentFacade.addAuthor( summaryInformation.getAuthor() );

    if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getKeywords() ) )
        htmlDocumentFacade.addKeywords( summaryInformation.getKeywords() );

    if ( WordToHtmlUtils.isNotEmpty( summaryInformation.getComments() ) )
        htmlDocumentFacade
                .addDescription( summaryInformation.getComments() );
}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:18,代码来源:WordToHtmlConverter.java

示例7: processDocumentInformation

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
@Override
protected void processDocumentInformation(
        SummaryInformation summaryInformation )
{
    if ( isOutputSummaryInformation() )
    {
        if ( AbstractWordUtils.isNotEmpty( summaryInformation.getTitle() ) )
            textDocumentFacade.setTitle( summaryInformation.getTitle() );

        if ( AbstractWordUtils.isNotEmpty( summaryInformation.getAuthor() ) )
            textDocumentFacade.addAuthor( summaryInformation.getAuthor() );

        if ( AbstractWordUtils
                .isNotEmpty( summaryInformation.getComments() ) )
            textDocumentFacade.addDescription( summaryInformation
                    .getComments() );

        if ( AbstractWordUtils
                .isNotEmpty( summaryInformation.getKeywords() ) )
            textDocumentFacade.addKeywords( summaryInformation
                    .getKeywords() );
    }
}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:24,代码来源:WordToTextConverter.java

示例8: processDocumentInformation

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
protected void processDocumentInformation(
        SummaryInformation summaryInformation )
{
    if ( ExcelToHtmlUtils.isNotEmpty( summaryInformation.getTitle() ) )
        htmlDocumentFacade.setTitle( summaryInformation.getTitle() );

    if ( ExcelToHtmlUtils.isNotEmpty( summaryInformation.getAuthor() ) )
        htmlDocumentFacade.addAuthor( summaryInformation.getAuthor() );

    if ( ExcelToHtmlUtils.isNotEmpty( summaryInformation.getKeywords() ) )
        htmlDocumentFacade.addKeywords( summaryInformation.getKeywords() );

    if ( ExcelToHtmlUtils.isNotEmpty( summaryInformation.getComments() ) )
        htmlDocumentFacade
                .addDescription( summaryInformation.getComments() );
}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:17,代码来源:ExcelToHtmlConverter.java

示例9: oldWordExtraction

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
private void oldWordExtraction(ParserResultItem result,
		InputStream inputStream) throws IOException {
	Word6Extractor word6 = null;
	try {
		word6 = new Word6Extractor(inputStream);
		SummaryInformation si = word6.getSummaryInformation();
		if (si != null) {
			result.addField(ParserFieldEnum.title, si.getTitle());
			result.addField(ParserFieldEnum.author, si.getAuthor());
			result.addField(ParserFieldEnum.subject, si.getSubject());
		}

		String text = word6.getText();
		String[] frags = text.split("\\n");
		for (String frag : frags)
			result.addField(ParserFieldEnum.content,
					StringUtils.replaceConsecutiveSpaces(frag, " "));
	} finally {
		IOUtils.close(word6);
	}
}
 
开发者ID:jaeksoft,项目名称:opensearchserver,代码行数:22,代码来源:DocParser.java

示例10: parseContent

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
@Override
protected void parseContent(StreamLimiter streamLimiter, LanguageEnum lang)
		throws IOException {
	VisioTextExtractor extractor = null;
	try {
		extractor = new VisioTextExtractor(
				streamLimiter.getNewInputStream());
		SummaryInformation info = extractor.getSummaryInformation();
		ParserResultItem result = getNewParserResultItem();

		if (info != null) {
			result.addField(ParserFieldEnum.title, info.getTitle());
			result.addField(ParserFieldEnum.author, info.getAuthor());
			result.addField(ParserFieldEnum.subject, info.getSubject());
		}
		String[] texts = extractor.getAllText();
		if (texts == null)
			return;
		for (String text : texts)
			result.addField(ParserFieldEnum.content,
					StringUtils.replaceConsecutiveSpaces(text, " "));
		result.langDetection(10000, ParserFieldEnum.content);
	} finally {
		IOUtils.close(extractor);
	}
}
 
开发者ID:jaeksoft,项目名称:opensearchserver,代码行数:27,代码来源:VisioParser.java

示例11: parseContent

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
@Override
protected void parseContent(StreamLimiter streamLimiter, LanguageEnum lang)
		throws IOException {
	PublisherTextExtractor extractor = null;
	try {
		extractor = new PublisherTextExtractor(
				streamLimiter.getNewInputStream());
		SummaryInformation info = extractor.getSummaryInformation();
		ParserResultItem result = getNewParserResultItem();
		if (info != null) {
			result.addField(ParserFieldEnum.title, info.getTitle());
			result.addField(ParserFieldEnum.author, info.getAuthor());
			result.addField(ParserFieldEnum.subject, info.getSubject());
		}
		result.addField(ParserFieldEnum.content, StringUtils
				.replaceConsecutiveSpaces(extractor.getText(), " "));
		result.langDetection(10000, ParserFieldEnum.content);
	} finally {
		IOUtils.close(extractor);
	}
}
 
开发者ID:jaeksoft,项目名称:opensearchserver,代码行数:22,代码来源:PublisherParser.java

示例12: create

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
@Override
public TreeModelSource create(final POIFSFileSystem poifs, final DefaultMutableTreeNode parent) {
	final DirectoryNode dn = poifs.getRoot();
	if (dn.hasEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME) ||
		dn.hasEntry(SummaryInformation.DEFAULT_STREAM_NAME)) {
		return appContext.getBean(HPSFTreeModel.class, parent);
	}
	return null;
}
 
开发者ID:kiwiwings,项目名称:poi-visualizer,代码行数:10,代码来源:HPSFTreeModelFactory.java

示例13: testKeepsEverythingElse

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
@Test
void testKeepsEverythingElse() {
    Entry entry = mock(Entry.class);
    doReturn(SummaryInformation.DEFAULT_STREAM_NAME).when(entry).getName();
    assertTrue(instance.test(entry), "Non-macro streams should be ignored");
    BleachTestBase.assertThreatsFound(session, 0);
    reset(session);

    doReturn("RandomName").when(entry).getName();
    assertTrue(instance.test(entry), "Non-macro streams should be ignored");
    BleachTestBase.assertThreatsFound(session, 0);
    reset(session);
}
 
开发者ID:docbleach,项目名称:DocBleach,代码行数:14,代码来源:MacroRemoverTest.java

示例14: sanitizeComments

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
@Test
void sanitizeComments() {
    SummaryInformation si = new SummaryInformation();

    // When no comment is set, no error/threat is thrown
    instance.sanitizeComments(session, si);
    assertThreatsFound(session, 0);

    // When a comment is set, it should be removed
    si.setComments("Hello!");
    instance.sanitizeComments(session, si);
    assertNull(si.getComments());
    assertThreatsFound(session, 1);
}
 
开发者ID:docbleach,项目名称:DocBleach,代码行数:15,代码来源:SummaryInformationSanitiserTest.java

示例15: testKeepsEverythingElse

import org.apache.poi.hpsf.SummaryInformation; //导入依赖的package包/类
@Test
void testKeepsEverythingElse() {
    Entry entry = mock(Entry.class);
    doReturn(SummaryInformation.DEFAULT_STREAM_NAME).when(entry).getName();
    assertTrue(instance.test(entry), "Non-object entries should be ignored");
    BleachTestBase.assertThreatsFound(session, 0);
    reset(session);

    doReturn("RandomName").when(entry).getName();
    assertTrue(instance.test(entry), "Non-object entries should be ignored");
    BleachTestBase.assertThreatsFound(session, 0);
    reset(session);
}
 
开发者ID:docbleach,项目名称:DocBleach,代码行数:14,代码来源:ObjectRemoverTest.java


注:本文中的org.apache.poi.hpsf.SummaryInformation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。