paulcwarren / spring-content

Cloud-Native Storage and Enterprise Content Services (ECMS) for Spring
https://paulcwarren.github.io/spring-content/
Apache License 2.0
275 stars 67 forks source link

Fix S3 PartialContentInputStream to be compliant to InputStream specification #2217

Open vierbergenlars opened 4 days ago

vierbergenlars commented 4 days ago

The PartialContentInputStream was a minimal implementation that worked well when used directly with the spring byte-range support.

However, using the InputStream variant in any other place (like wrapping it for decryption), the minimal implementation breaks down, requiring workarounds when handling the encryption. Using an implementation that is fully compliant with the InputStream specifications makes implementation of a wrapping InputStream easier, as no special provisions need to be made for a read method that immediately reads the byte-range (instead of empty space before the start of the byte-range)