This question already has an answer here:
I have an object belonging to a custom class which extends ServletOutputStream. Since OutputStreams are meant to be written to, it has methods to write(..).
My requirement is to read from it. If this was of type ByteArrayOutputStream, then this would be simple - I would just get the bytearrayoutputsteam.toByteArray() and feed it to a constructor for ByteArrayInputStream, and then read at will.
This object though extends from ServletOutputStream and there is no way to get the bytes nor read anything.
I am actually getting this object via Java Reflection API (not that it matters). Is there any way to read from this?
Aucun commentaire:
Enregistrer un commentaire