FileDocCategorySizeDatePackage
UnsyncBufferedOutputStream.javaAPI DocJava SE 6 API2072Tue Jun 10 00:23:04 BST 2008com.sun.org.apache.xml.internal.security.utils

UnsyncBufferedOutputStream

public class UnsyncBufferedOutputStream extends OutputStream
A class that buffers writte without synchronize its methods
author
raul

Fields Summary
final OutputStream
out
static final int
size
final byte[]
buf
int
pointer
Constructors Summary
public UnsyncBufferedOutputStream(OutputStream out)
Creates a buffered output stream without synchronization

param
out the outputstream to buffer

	             	 
	   
		this.out=out;
	
Methods Summary
public voidclose()

inheritDoc

		flush();		
	
public voidflush()

inheritDoc

		flushBuffer();
		out.flush();
	
private final voidflushBuffer()

		if (pointer>0)
			out.write(buf,0,pointer);
		pointer=0;
		
	
public voidwrite(byte[] arg0)

inheritDoc

		write(arg0,0,arg0.length);
	
public voidwrite(byte[] arg0, int arg1, int len)

inheritDoc

		int newLen=pointer+len;
		if (newLen> size) {
			flushBuffer();		
			if (len>size) {
				out.write(arg0,arg1,len);
				return;
			}
			newLen=len;
		}
		System.arraycopy(arg0,arg1,buf,pointer,len);
		pointer=newLen;
	
public voidwrite(int arg0)

inheritDoc

		
		if (pointer>= size) {
			flushBuffer();
		}
		buf[pointer++]=(byte)arg0;