Class ReadOnlyFilteredCOSStream

java.lang.Object
org.sejda.sambox.cos.COSBase
org.sejda.sambox.cos.COSDictionary
org.sejda.sambox.cos.COSStream
org.sejda.impl.sambox.component.ReadOnlyFilteredCOSStream
All Implemented Interfaces:
Closeable, AutoCloseable, org.sejda.sambox.cos.COSObjectable, org.sejda.sambox.cos.Encryptable

public class ReadOnlyFilteredCOSStream extends org.sejda.sambox.cos.COSStream
A read only, filtered, encryptable, indirect reference length COSStream whose purpose is to be read by the PDF writer during the write process. This can allow to create streams from File input streams and predefine the expected dictionary without having to read anything into memory.
Author:
Andrea Vacondio
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
  • Field Summary

    Fields inherited from class org.sejda.sambox.cos.COSDictionary

    items
  • Constructor Summary

    Constructors
    Constructor
    Description
    ReadOnlyFilteredCOSStream(org.sejda.sambox.cos.COSDictionary existingDictionary, ReadOnlyFilteredCOSStream.InputStreamSupplier<InputStream> supplier, long length)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    void
     
     
    createFilteredStream(org.sejda.sambox.cos.COSBase filters)
     
     
    protected InputStream
     
    boolean
     
    void
    encryptable(boolean encryptable)
     
    long
     
    long
     
    org.sejda.io.SeekableSource
     
     
    org.sejda.sambox.cos.IndirectCOSObjectIdentifier
    id()
     
    void
    idIfAbsent(org.sejda.sambox.cos.IndirectCOSObjectIdentifier id)
     
    boolean
     
    void
    indirectLength(boolean indirectLength)
     
    boolean
     
    readOnly(org.sejda.sambox.cos.COSStream existing)
    a ReadOnlyFilteredCOSStream from an existing COSStream
    a ReadOnlyFilteredCOSStream representing an embedded file stream
    readOnlyJpegImage(File imageFile, int width, int height, int bitsPerComponent, org.sejda.sambox.pdmodel.graphics.color.PDColorSpace colorSpace)
    a ReadOnlyFilteredCOSStream that represents an xobject JPEG image
    void
    setFilters(org.sejda.sambox.cos.COSBase filters)
     

    Methods inherited from class org.sejda.sambox.cos.COSStream

    accept, asTextString, getDecodeResult, getFilteredSource, getFilteredStream, getFilters, getUnfilteredByteBuffer, hasFilter, setEncryptor, unDecode

    Methods inherited from class org.sejda.sambox.cos.COSDictionary

    addAll, asUnmodifiableDictionary, clear, containsKey, containsKey, duplicate, entrySet, getBoolean, getBoolean, getBoolean, getCOSArray, getCOSName, getCOSName, getDate, getDate, getDate, getDate, getDictionaryObject, getDictionaryObject, getDictionaryObject, getDictionaryObject, getDictionaryObject, getDictionaryObject, getEmbeddedDate, getEmbeddedDate, getEmbeddedDate, getEmbeddedDate, getEmbeddedInt, getEmbeddedInt, getEmbeddedInt, getEmbeddedInt, getEmbeddedString, getEmbeddedString, getEmbeddedString, getEmbeddedString, getFlag, getFloat, getFloat, getFloat, getFloat, getInt, getInt, getInt, getInt, getInt, getInt, getItem, getItem, getItem, getKeyForValue, getLong, getLong, getLong, getLong, getNameAsString, getNameAsString, getNameAsString, getNameAsString, getString, getString, getString, getString, getValues, keySet, merge, mergeWithoutOverwriting, putIfAbsent, putIfAbsent, putIfAbsent, putIfAbsent, putIfAbsent, putIfAbsent, removeItem, removeItems, setBoolean, setBoolean, setDate, setDate, setEmbeddedDate, setEmbeddedDate, setEmbeddedInt, setEmbeddedInt, setEmbeddedString, setEmbeddedString, setFlag, setFloat, setFloat, setInt, setInt, setItem, setItem, setItem, setItem, setLong, setLong, setName, setName, setString, setString, size, toString

    Methods inherited from class org.sejda.sambox.cos.COSBase

    getCOSObject, hasId

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • Method Details

    • doGetFilteredStream

      protected InputStream doGetFilteredStream() throws IOException
      Overrides:
      doGetFilteredStream in class org.sejda.sambox.cos.COSStream
      Throws:
      IOException
    • getFilteredLength

      public long getFilteredLength() throws IOException
      Overrides:
      getFilteredLength in class org.sejda.sambox.cos.COSStream
      Throws:
      IOException
    • getUnfilteredLength

      public long getUnfilteredLength() throws IOException
      Overrides:
      getUnfilteredLength in class org.sejda.sambox.cos.COSStream
      Throws:
      IOException
    • getUnfilteredStream

      public InputStream getUnfilteredStream() throws IOException
      Overrides:
      getUnfilteredStream in class org.sejda.sambox.cos.COSStream
      Throws:
      IOException
    • getUnfilteredSource

      public org.sejda.io.SeekableSource getUnfilteredSource() throws IOException
      Overrides:
      getUnfilteredSource in class org.sejda.sambox.cos.COSStream
      Throws:
      IOException
    • createFilteredStream

      public OutputStream createFilteredStream()
      Overrides:
      createFilteredStream in class org.sejda.sambox.cos.COSStream
    • createFilteredStream

      public OutputStream createFilteredStream(org.sejda.sambox.cos.COSBase filters)
      Overrides:
      createFilteredStream in class org.sejda.sambox.cos.COSStream
    • setFilters

      public void setFilters(org.sejda.sambox.cos.COSBase filters)
      Overrides:
      setFilters in class org.sejda.sambox.cos.COSStream
    • addCompression

      public boolean addCompression()
      Overrides:
      addCompression in class org.sejda.sambox.cos.COSStream
    • encryptable

      public boolean encryptable()
      Specified by:
      encryptable in interface org.sejda.sambox.cos.Encryptable
      Overrides:
      encryptable in class org.sejda.sambox.cos.COSStream
    • encryptable

      public void encryptable(boolean encryptable)
      Specified by:
      encryptable in interface org.sejda.sambox.cos.Encryptable
      Overrides:
      encryptable in class org.sejda.sambox.cos.COSStream
    • createUnfilteredStream

      public OutputStream createUnfilteredStream()
      Overrides:
      createUnfilteredStream in class org.sejda.sambox.cos.COSStream
    • isEmpty

      public boolean isEmpty()
      Overrides:
      isEmpty in class org.sejda.sambox.cos.COSStream
    • indirectLength

      public boolean indirectLength()
      Overrides:
      indirectLength in class org.sejda.sambox.cos.COSStream
    • indirectLength

      public void indirectLength(boolean indirectLength)
      Overrides:
      indirectLength in class org.sejda.sambox.cos.COSStream
    • id

      public org.sejda.sambox.cos.IndirectCOSObjectIdentifier id()
      Overrides:
      id in class org.sejda.sambox.cos.COSBase
    • idIfAbsent

      public void idIfAbsent(org.sejda.sambox.cos.IndirectCOSObjectIdentifier id)
      Overrides:
      idIfAbsent in class org.sejda.sambox.cos.COSBase
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class org.sejda.sambox.cos.COSStream
      Throws:
      IOException
    • readOnly

      public static ReadOnlyFilteredCOSStream readOnly(org.sejda.sambox.cos.COSStream existing) throws IOException
      a ReadOnlyFilteredCOSStream from an existing COSStream
      Parameters:
      existing -
      Returns:
      the created instance
      Throws:
      IOException
    • readOnlyJpegImage

      public static ReadOnlyFilteredCOSStream readOnlyJpegImage(File imageFile, int width, int height, int bitsPerComponent, org.sejda.sambox.pdmodel.graphics.color.PDColorSpace colorSpace)
      a ReadOnlyFilteredCOSStream that represents an xobject JPEG image
      Parameters:
      imageFile - the image file
      width -
      height -
      bitsPerComponent -
      colorSpace -
      Returns:
      the created instance
      Throws:
      FileNotFoundException
    • readOnlyEmbeddedFile

      public static final ReadOnlyFilteredCOSStream readOnlyEmbeddedFile(Source<?> source) throws TaskIOException
      a ReadOnlyFilteredCOSStream representing an embedded file stream
      Parameters:
      source -
      Returns:
      the created instance
      Throws:
      TaskIOException