01: package org.jgroups.util;
02:
03: import java.io.ByteArrayOutputStream;
04:
05: /**
06: * Extends ByteArrayOutputStream, but exposes the internal buffer. This way we don't need to call
07: * toByteArray() which copies the internal buffer
08: * @author Bela Ban
09: * @version $Id: ExposedByteArrayOutputStream.java,v 1.2 2005/07/25 15:53:36 belaban Exp $
10: */
11: public class ExposedByteArrayOutputStream extends ByteArrayOutputStream {
12:
13: public ExposedByteArrayOutputStream() {
14: }
15:
16: public ExposedByteArrayOutputStream(int size) {
17: super (size);
18: }
19:
20: public byte[] getRawBuffer() {
21: return buf;
22: }
23:
24: public int getCapacity() {
25: return buf.length;
26: }
27: }
|