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


Java SeekableSources.inMemorySeekableSourceFrom方法代码示例

本文整理汇总了Java中org.sejda.io.SeekableSources.inMemorySeekableSourceFrom方法的典型用法代码示例。如果您正苦于以下问题:Java SeekableSources.inMemorySeekableSourceFrom方法的具体用法?Java SeekableSources.inMemorySeekableSourceFrom怎么用?Java SeekableSources.inMemorySeekableSourceFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.sejda.io.SeekableSources的用法示例。


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

示例1: scanCorruptedStreamAndTable

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void scanCorruptedStreamAndTable() throws IOException
{
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(getClass()
            .getResourceAsStream("/sambox/test_xref_corrupted_stream_and_table.pdf")));
    victim = new XrefParser(parser);
    victim.parse();
    assertEquals(562, victim.trailer().getCOSObject().getInt(COSName.PREV));
    assertEquals(9, victim.trailer().getCOSObject().getInt(COSName.SIZE));
    assertNotNull(victim.trailer().getCOSObject().getDictionaryObject(COSName.ROOT));
    COSDictionary overriddenObj = (COSDictionary) parser.provider().get(new COSObjectKey(3, 0))
            .getCOSObject();
    assertEquals(919, victim.trailer().xrefOffset());
    assertNull(overriddenObj.getDictionaryObject(COSName.ANNOTS));
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:16,代码来源:XrefParserTest.java

示例2: readLong

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void readLong() throws IOException
{
    String data = Long.MAX_VALUE + " 0 obj <</key value>>";
    SeekableSource source = SeekableSources.inMemorySeekableSourceFrom(data.getBytes());
    victim = new SourceReader(source);
    assertEquals(Long.MAX_VALUE, victim.readLong());
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:9,代码来源:SourceReaderTest.java

示例3: readInt

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void readInt() throws IOException
{
    String data = Integer.MAX_VALUE + " 0 obj <</key value>>";
    SeekableSource source = SeekableSources.inMemorySeekableSourceFrom(data.getBytes());
    victim = new SourceReader(source);
    assertEquals(Integer.MAX_VALUE, victim.readInt());
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:9,代码来源:SourceReaderTest.java

示例4: scanMultipleTablesFallsbackOnFullScannerOnWrongObjectOffset

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void scanMultipleTablesFallsbackOnFullScannerOnWrongObjectOffset() throws IOException
{
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(getClass()
            .getResourceAsStream("/sambox/test_multiple_xref_tables_wrong_object_offset.pdf")));
    victim = new XrefParser(parser);
    victim.parse();
    assertEquals(108, victim.trailer().getCOSObject().getInt(COSName.PREV));
    assertEquals(8, victim.trailer().getCOSObject().getInt(COSName.SIZE));
    assertNotNull(victim.trailer().getCOSObject().getDictionaryObject(COSName.ROOT));
    COSDictionary overriddenObj = (COSDictionary) parser.provider().get(new COSObjectKey(3, 0))
            .getCOSObject();
    assertEquals(839, victim.trailer().xrefOffset());
    assertNotNull(overriddenObj.getDictionaryObject(COSName.ANNOTS));
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:16,代码来源:XrefParserTest.java

示例5: getCompressed

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void getCompressed() throws IOException
{
    victim = new LazyIndirectObjectsProvider();
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(
            getClass().getResourceAsStream("/sambox/simple_test_objstm.pdf")), victim);
    victim.initializeWith(parser);
    XrefParser xrefParser = new XrefParser(parser);
    xrefParser.parse();
    assertNotNull(victim.get(new COSObjectKey(6, 0)));
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:12,代码来源:LazyIndirectObjectsProviderTest.java

示例6: scanBogusDictionary

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void scanBogusDictionary() throws IOException
{
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(getClass()
            .getResourceAsStream("/sambox/test_multiple_xref_tables_bogus_trailer.pdf")));
    victim = new XrefParser(parser);
    victim.parse();
    assertEquals(8, victim.trailer().getCOSObject().getInt(COSName.SIZE));
    assertNotNull(victim.trailer().getCOSObject().getDictionaryObject(COSName.ROOT));
    COSDictionary overriddenObj = (COSDictionary) parser.provider().get(new COSObjectKey(3, 0))
            .getCOSObject();
    assertEquals(839, victim.trailer().xrefOffset());
    assertNotNull(overriddenObj.getDictionaryObject(COSName.ANNOTS));
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:15,代码来源:XrefParserTest.java

示例7: getCompressedWrongOwningStreamCompressed

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void getCompressedWrongOwningStreamCompressed() throws IOException
{
    victim = new LazyIndirectObjectsProvider();
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(
            getClass().getResourceAsStream("/sambox/simple_test_objstm.pdf")), victim);
    victim.initializeWith(parser);
    XrefParser xrefParser = new XrefParser(parser);
    xrefParser.parse();
    victim.addEntry(CompressedXrefEntry.compressedEntry(6, 4, 1));
    assertNull(victim.get(new COSObjectKey(6, 0)));
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:13,代码来源:LazyIndirectObjectsProviderTest.java

示例8: scanBogusPrev

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void scanBogusPrev() throws IOException
{
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(getClass()
            .getResourceAsStream("/sambox/test_multiple_xref_tables_bogus_prev.pdf")));
    victim = new XrefParser(parser);
    victim.parse();
    assertEquals(8, victim.trailer().getCOSObject().getInt(COSName.SIZE));
    assertNotNull(victim.trailer().getCOSObject().getDictionaryObject(COSName.ROOT));
    COSDictionary overriddenObj = (COSDictionary) parser.provider().get(new COSObjectKey(3, 0))
            .getCOSObject();
    assertEquals(839, victim.trailer().xrefOffset());
    assertNotNull(overriddenObj.getDictionaryObject(COSName.ANNOTS));
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:15,代码来源:XrefParserTest.java

示例9: fallbackDoesntWorkForObjStm

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void fallbackDoesntWorkForObjStm() throws IOException
{
    victim = new LazyIndirectObjectsProvider();
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(
            getClass().getResourceAsStream("/sambox/bad_objstm.pdf")), victim);
    victim.initializeWith(parser);
    XrefParser xrefParser = new XrefParser(parser);
    xrefParser.parse();
    assertNull(victim.get(new COSObjectKey(6, 0)));
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:12,代码来源:LazyIndirectObjectsProviderTest.java

示例10: scanStreamAndTable

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void scanStreamAndTable() throws IOException
{
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(
            getClass().getResourceAsStream("/sambox/test_xref_stream_and_table.pdf")));
    victim = new XrefParser(parser);
    victim.parse();
    assertEquals(562, victim.trailer().getCOSObject().getInt(COSName.PREV));
    assertEquals(9, victim.trailer().getCOSObject().getInt(COSName.SIZE));
    assertNotNull(victim.trailer().getCOSObject().getDictionaryObject(COSName.ROOT));
    COSDictionary overriddenObj = (COSDictionary) parser.provider().get(new COSObjectKey(3, 0))
            .getCOSObject();
    assertEquals(919, victim.trailer().xrefOffset());
    assertNull(overriddenObj.getDictionaryObject(COSName.ANNOTS));
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:16,代码来源:XrefParserTest.java

示例11: emptyObj

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void emptyObj() throws IOException
{
    victim = new LazyIndirectObjectsProvider();
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(
            getClass().getResourceAsStream("/sambox/empty_obj.txt")), victim);
    victim.initializeWith(parser);
    victim.addEntry(XrefEntry.inUseEntry(10, 3, 0));
    assertEquals(COSNull.NULL, victim.get(new COSObjectKey(10, 0)));
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:11,代码来源:LazyIndirectObjectsProviderTest.java

示例12: scanMultipleTables

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void scanMultipleTables() throws IOException
{
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(
            getClass().getResourceAsStream("/sambox/test_multiple_xref_tables.pdf")));
    victim = new XrefFullScanner(parser);
    assertEquals(XrefScanOutcome.FOUND, victim.scan());
    assertEquals(408, victim.trailer().getCOSObject().getInt(COSName.PREV));
    assertEquals(8, victim.trailer().getCOSObject().getInt(COSName.SIZE));
    assertNotNull(victim.trailer().getCOSObject().getDictionaryObject(COSName.ROOT));
    COSDictionary overriddenObj = (COSDictionary) parser.provider().get(new COSObjectKey(3, 0))
            .getCOSObject();
    assertNotNull(overriddenObj.getDictionaryObject(COSName.ANNOTS));
    assertEquals(839, victim.trailer().xrefOffset());
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:16,代码来源:XrefFullScannerTest.java

示例13: scanWrongStartxrefAndMissingXref

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void scanWrongStartxrefAndMissingXref() throws IOException
{
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(
            getClass().getResourceAsStream("/sambox/test_xref_issue23.pdf")));
    victim = new XrefParser(parser);
    victim.parse();
    assertEquals(10, victim.trailer().getCOSObject().getInt(COSName.SIZE));
    assertNotNull(victim.trailer().getCOSObject().getDictionaryObject(COSName.ROOT));
    assertEquals(-1, victim.trailer().xrefOffset());
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:12,代码来源:XrefParserTest.java

示例14: scanCorruptedStreamAndTable

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void scanCorruptedStreamAndTable() throws IOException
{
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(getClass()
            .getResourceAsStream("/sambox/test_xref_corrupted_stream_and_table.pdf")));
    victim = new XrefFullScanner(parser);
    victim.scan();
    assertEquals(XrefScanOutcome.WITH_ERRORS, victim.scan());
    assertNotNull(victim.trailer().getCOSObject().getDictionaryObject(COSName.ROOT));
    assertEquals(562, victim.trailer().xrefOffset());
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:12,代码来源:XrefFullScannerTest.java

示例15: missingXref

import org.sejda.io.SeekableSources; //导入方法依赖的package包/类
@Test
public void missingXref() throws IOException
{
    parser = new COSParser(SeekableSources.inMemorySeekableSourceFrom(
            getClass().getResourceAsStream("/sambox/test_xref_missing_xref.pdf")));
    victim = new XrefFullScanner(parser);
    assertEquals(XrefScanOutcome.NOT_FOUND, victim.scan());
    assertEquals(-1, victim.trailer().xrefOffset());
}
 
开发者ID:torakiki,项目名称:sambox,代码行数:10,代码来源:XrefFullScannerTest.java


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