I boosted the PushbackInputStream | OpenJDK Contrib | Java Coding | Head Crashing Informatics 66

Опубликовано: 22 Февраль 2026
на канале: Markus Karg
68
6

As #PushbackInputStream is quite similar to #BufferedInputStream, it was rather easy for me to apply the performance optimizations I already developed for BufferedInputStream to the PushbackInputStream. The contribution was accepted in November 2022, so it is now part of #OpenJDK (aka #Java) 20.

The change will make your application #transferTo bytes faster in case your source or target is a file stream and you wrapped it using a PushbackInputStream. For example, if you read the magic byte of a file to find out about the file type, then push it back and transferTo() the complete content to a specific image processing algorithm, the bytes will not walk through the in-memory buffer anymore, sparing processing time.

If you missed the original contribution last year, check my channel page, it is covered by a four-parts series!

If you like this video, please give it a thumbs up, share it, subscribe to my channel, or become my patreon   / mkarg  . Thanks! :-)

Jewellery by stkarg.design (  / stkarg.design  )

A Peilung 0 Production (   / @peilung0943  )