BufferedInputStream to Byte Array

Does Anybody know how to convert a BufferedInputStream into Byte array byte[]?

I did this but It doesn't work, take a look.

private byte[] Convert(BufferedInputStream oStream) throws IOException {

byte[] bytesLeidos = new byte[0];

int longitudBytes = oStream.read(bytesLeidos);

return bytesLeidos;

}

I used the read method from FilterInputStream which returns the lenght of the byte array, but also stores the byte array in a buffer, in this case "bytesLeidos". It appears easy to work but it doesn't work. Please help.

[571 byte] By [EduSpaina] at [2007-10-2 22:02:23]
# 1
byte[] bytesLeidos = new byte[0];The buffer seems to be somewhat undersized.
BIJ001a at 2007-7-14 1:18:51 > top of Java-index,Java Essentials,Java Programming...
# 2
Use a fixed-size byte[] as buffer and write anything into an instance of ByteArrayOutputStream in a loop until the end of stream. Then call toByteArray() on the ByteArrayOutputStream -- voil?
quittea at 2007-7-14 1:18:51 > top of Java-index,Java Essentials,Java Programming...