¿Cómo obtener el tamaño de un InputStream?

Estoy teniendo unInputStream a partir de unaProcessBuilder que lee agudamente elstdout corriente.

Pregunta: ¿cómo puedo saber el tamaño de esa memoria?InputStream, así puedo escribirlo a unHttpResponse encabezado http?

InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);

OutputStream out = response.getOutputStream();
int bytes;
while ((bytes = br.read()) != -1) {
    out.write(bytes);
}

//how can I know the size of the inmemory stream/file written?
//response.setContentLength((int) pdfFile.length());

Respuestas a la pregunta(5)

Su respuesta a la pregunta