Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Using Java ByteArrayOutputStream Objects

  • 22-03-2003 09:58PM
    #1
    Closed Accounts Posts: 741 ✭✭✭


    I have a problem in Java when using java.io.ByteArrayOutputStreams objects. Every time I use the toByteArray() method it seems to substantially increase the ByteArrayOutputStream objects length. Does anyone know why this is and/or how to get around it. Any help would be much appreciated..


Comments

  • Closed Accounts Posts: 110 ✭✭Korg


    Could you paste in a bit of code to show this happening? From the java api source toByteArray() doesn't do that much, maybe it's something else that's having the effect or maybe i'm missing something.

    [PHP]
    From java.io.ByteArrayOutputStream.java

    public synchronized byte toByteArray()[] {
    byte newbuf[] = new byte[count];
    System.arraycopy(buf, 0, newbuf, 0, count);
    return newbuf;
    [/PHP]


Advertisement