FileDocCategorySizeDatePackage
HexOutputStream.javaAPI DocJava SE 5 API1537Fri Aug 26 14:54:28 BST 2005com.sun.corba.se.impl.orbutil

HexOutputStream

public class HexOutputStream extends OutputStream
Writes each input byte as a 2 byte hexidecimal output pair making it possible to turn arbitrary binary data into an ASCII format. The high 4 bits of the byte is translated into the first byte.
author
Jeff Nisewanger

Fields Summary
private static final char[]
hex
private StringWriter
writer
Constructors Summary
public HexOutputStream(StringWriter w)
Creates a new HexOutputStream.

param
w The underlying StringWriter.

 

          	       
    
	  
        writer = w;
    
Methods Summary
public synchronized voidwrite(int b)
Writes a byte. Will block until the byte is actually written. param b The byte to write out.

exception
java.io.IOException I/O error occurred.

	writer.write(hex[((b >> 4) & 0xF)]);
	writer.write(hex[((b >> 0) & 0xF)]);
    
public synchronized voidwrite(byte[] b)

	write(b, 0, b.length);
    
public synchronized voidwrite(byte[] b, int off, int len)

	for(int i=0; i < len; i++) {
	    write(b[off + i]);
	}