Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

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