01: package org.bouncycastle.crypto.tls;
02:
03: import java.io.IOException;
04: import java.io.OutputStream;
05:
06: /**
07: * An OutputStream for an TLS connection.
08: */
09: public class TlsOuputStream extends OutputStream {
10: private byte[] buf = new byte[1];
11: private TlsProtocolHandler handler;
12:
13: TlsOuputStream(TlsProtocolHandler handler) {
14: this .handler = handler;
15: }
16:
17: public void write(byte buf[], int offset, int len)
18: throws IOException {
19: this .handler.writeData(buf, offset, len);
20: }
21:
22: public void write(int arg0) throws IOException {
23: buf[0] = (byte) arg0;
24: this .write(buf, 0, 1);
25: }
26:
27: /** @deprecated Use 'close' instead */
28: public void cose() throws IOException {
29: handler.close();
30: }
31:
32: public void close() throws IOException {
33: handler.close();
34: }
35:
36: public void flush() throws IOException {
37: handler.flush();
38: }
39: }
|