I have some InputStream as argument:
public byte[] ellipsis(InputStream is) {
// some code
}
I have some threshold, eg 10_000 bytes.
I want to do the following:
If InputStream size is more than the threshold, it is necessary to cut 2/3 of the message from the beginning and 1000 bytes from the end from the incoming stream, and replace the middle with three dots (...), translate this into an array of bytes and return.
The whole problem is that I don't know the length of the stream until I read it.
Maybe there are ways to do this or some libraries for this?