01: package dalma.endpoints.jms.impl;
02:
03: import java.io.ByteArrayOutputStream;
04: import java.io.InputStream;
05: import java.io.ByteArrayInputStream;
06:
07: /**
08: * Readable/writable memory buffer.
09: *
10: * @author Kohsuke Kawaguchi
11: */
12: final class Buffer extends ByteArrayOutputStream {
13: public Buffer() {
14: }
15:
16: public Buffer(byte[] data) {
17: super (0);
18: super .buf = data;
19: }
20:
21: public InputStream newInputStream() {
22: return new ByteArrayInputStream(buf, 0, count);
23: }
24:
25: public byte[] getBuffer() {
26: return buf;
27: }
28:
29: public int size() {
30: return count;
31: }
32: }
|