當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。