/[classpath]/inetlib/source/gnu/inet/util/SaslOutputStream.java
ViewVC logotype

Diff of /inetlib/source/gnu/inet/util/SaslOutputStream.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dog, Sun Oct 19 08:51:37 2003 UTC revision 1.2 by dog, Sun Oct 19 16:16:50 2003 UTC
# Line 40  import javax.security.sasl.SaslClient; Line 40  import javax.security.sasl.SaslClient;
40   * @author <a href="mailto:dog@gnu.org">Chris Burdess</a>   * @author <a href="mailto:dog@gnu.org">Chris Burdess</a>
41   * @version $Revision$ $Date$   * @version $Revision$ $Date$
42   */   */
43  public class SaslOutputStream  public class SaslOutputStream extends FilterOutputStream
         extends FilterOutputStream  
44  {  {
45    
46          /*    /*
47           * The SASL client used for encoding data.     * The SASL client used for encoding data.
48           */     */
49          private final SaslClient sasl;    private final SaslClient sasl;
50            
51          /**          /**
52           * Constructor.           * Constructor.
53           * @param sasl the SASL client           * @param sasl the SASL client
54           * @param out the target output stream           * @param out the target output stream
55           */           */
56          public SaslOutputStream(SaslClient sasl, OutputStream out)    public SaslOutputStream(SaslClient sasl, OutputStream out)
57          {    {
58                  super(out);      super(out);
59                  this.sasl = sasl;      this.sasl = sasl;
60          }    }
61            
62          /**          /**
63           * Character write.           * Character write.
64           */           */
65          public void write(int c)    public void write(int c) throws IOException
66                  throws IOException    {
67          {      byte[] bytes = new byte[1];
68                  byte[] bytes = new byte[1];      bytes[0] = (byte) c;
69                  bytes[0] = (byte)c;      write(bytes, 0, 1);
70                  write(bytes, 0, 1);    }
71          }  
72      public void write(byte[]bytes) throws IOException
73          public void write(byte[] bytes)    {
74                  throws IOException      write(bytes, 0, bytes.length);
75          {    }
76                  write(bytes, 0, bytes.length);  
77          }          /**
           
         /**  
78           * Block write.           * Block write.
79           */           */
80          public void write(byte[] bytes, int off, int len)    public void write(byte[]bytes, int off, int len) throws IOException
81                  throws IOException    {
82          {      byte[] wrapped = sasl.wrap(bytes, off, len);
83                  byte[] wrapped = sasl.wrap(bytes, off, len);      super.write(wrapped, 0, wrapped.length);
84                  super.write(wrapped, 0, wrapped.length);    }
         }  
           
 }  
85    
86    }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26