[ https://issues.apache.org/jira/browse/PDFBOX-2999?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14934842#comment-14934842 ]
Timo Boehme commented on PDFBOX-2999: ------------------------------------- Please see the answer to your first question in my comment below. bq. That's just an empty stream and it's perfectly legal. Maybe we should return a constant empty input stream in case there was no {{getOutputStream}} before. That way we don't have to create a not used buffer and don't have to close it. bq. It's not possible to create multiple output streams, ... While it is prevented to have multiple output streams in parallel it is fine (so far) to close an output stream and request a new one later. bq. However it is possible to have an existing input stream and then create an output stream, which we should probably disallow, because it doesn't make sense. This is what I had in mind. Either do not allow {{getOutputStream()}} after {{getInputStream()}} or at least close the random access buffer of the previous {{getOutpuStream()}} which also invalidates the input stream. > Optimize COSStream scratch file usage > ------------------------------------- > > Key: PDFBOX-2999 > URL: https://issues.apache.org/jira/browse/PDFBOX-2999 > Project: PDFBox > Issue Type: Improvement > Components: PDModel > Affects Versions: 2.0.0 > Reporter: Timo Boehme > Assignee: Timo Boehme > > The usage of scratch file buffers in COSStreams is quite sloppy. A never > filled buffer is created in the beginning and existing buffers are discarded > without being closed when a variant of {{createOutputStream}} is called. > Furthermore it should be clarified if requesting an input stream without > having created an output stream before is ok and if a returned input stream > keeps valid after a new output stream is created (which is crucial for proper > buffer-closing). > This issue should resolve some of the shortcomings and document the expected > or even required usage of COSStream. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org