KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > util > EncodingStream


1 package hudson.util;
2
3 import java.io.FilterOutputStream JavaDoc;
4 import java.io.IOException JavaDoc;
5 import java.io.OutputStream JavaDoc;
6
7 /**
8  * Hex-binary encoding stream.
9  *
10  * TODO: use base64binary.
11  *
12  * @author Kohsuke Kawaguchi
13  * @see DecodingStream
14  */

15 public class EncodingStream extends FilterOutputStream JavaDoc {
16     public EncodingStream(OutputStream JavaDoc out) {
17         super(out);
18     }
19
20     public void write(int b) throws IOException JavaDoc {
21         out.write(chars.charAt(b/16));
22         out.write(chars.charAt(b%16));
23     }
24
25     private static final String JavaDoc chars = "0123456789ABCDEF";
26 }
27
Popular Tags