1 |
/* |
/* |
2 |
* $Id$ |
* SaslOutputStream.java |
3 |
* Copyright (C) 2002 The Free Software Foundation |
* Copyright (C) 2002 The Free Software Foundation |
4 |
* |
* |
5 |
* This file is part of GNU inetlib, a library. |
* This file is part of GNU inetlib, a library. |
49 |
* client. |
* client. |
50 |
* |
* |
51 |
* @author <a href="mailto:dog@gnu.org">Chris Burdess</a> |
* @author <a href="mailto:dog@gnu.org">Chris Burdess</a> |
|
* @version $Revision$ $Date$ |
|
52 |
*/ |
*/ |
53 |
public class SaslOutputStream extends FilterOutputStream |
public class SaslOutputStream |
54 |
|
extends FilterOutputStream |
55 |
{ |
{ |
56 |
|
|
57 |
/* |
/* |
64 |
* @param sasl the SASL client |
* @param sasl the SASL client |
65 |
* @param out the target output stream |
* @param out the target output stream |
66 |
*/ |
*/ |
67 |
public SaslOutputStream (SaslClient sasl, OutputStream out) |
public SaslOutputStream(SaslClient sasl, OutputStream out) |
68 |
{ |
{ |
69 |
super (out); |
super(out); |
70 |
this.sasl = sasl; |
this.sasl = sasl; |
71 |
} |
} |
72 |
|
|
73 |
/** |
/** |
74 |
* Character write. |
* Character write. |
75 |
*/ |
*/ |
76 |
public void write (int c) throws IOException |
public void write(int c) |
77 |
{ |
throws IOException |
78 |
byte[] bytes = new byte[1]; |
{ |
79 |
bytes[0] = (byte) c; |
byte[] bytes = new byte[1]; |
80 |
write (bytes, 0, 1); |
bytes[0] = (byte) c; |
81 |
} |
write(bytes, 0, 1); |
82 |
|
} |
83 |
public void write (byte[] bytes) throws IOException |
|
84 |
{ |
public void write(byte[] bytes) |
85 |
write (bytes, 0, bytes.length); |
throws IOException |
86 |
} |
{ |
87 |
|
write(bytes, 0, bytes.length); |
88 |
|
} |
89 |
|
|
90 |
/** |
/** |
91 |
* Block write. |
* Block write. |
92 |
*/ |
*/ |
93 |
public void write (byte[] bytes, int off, int len) throws IOException |
public void write(byte[] bytes, int off, int len) |
94 |
{ |
throws IOException |
95 |
byte[] wrapped = sasl.wrap (bytes, off, len); |
{ |
96 |
super.write (wrapped, 0, wrapped.length); |
byte[] wrapped = sasl.wrap(bytes, off, len); |
97 |
} |
super.write(wrapped, 0, wrapped.length); |
98 |
|
} |
99 |
|
|
100 |
} |
} |
101 |
|
|