[url=“JDK 19 Documentation - Home”]JDK 19 Documentation - Home
Depending on what you know about the data, you can read() or skip() until the “good” data starts.
Although you don’t want to read really large chunks into memory, you should still read into a buffer for efficiency. You can construct a BufferedInputStream from an InputStream as described:
[url=“JDK 19 Documentation - Home”]JDK 19 Documentation - Home
I.E. java.io.BufferedInputStream myBufStrm = new java.io.BufferedInputStream myBufStrm(myInputStream,4028); //4K buffer
Once you hit the start of the good data, you can start using an OutputStream (also buffered) to write another file.
It would be interesting to hear a bit more about the larger problem you are working on. Is there any mapping or transformation involved?
#webMethods#Integration-Server-and-ESB#Flow-and-Java-services