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

UnsyncByteArrayOutputStream

public class UnsyncByteArrayOutputStream extends ByteArrayOutputStream
A simple Unsynced ByteArryOutputStream
author
raul

Fields Summary
int
size
byte[]
buf
int
pos
Constructors Summary
Methods Summary
voidexpandSize()

inheritDoc

		int newSize=size<<2;
		byte newBuf[]=new byte[newSize];
		System.arraycopy(buf,0,newBuf,0,pos);
		buf=newBuf;
		size=newSize;
		
	
public voidreset()

inheritDoc

		pos=0;
	
public byte[]toByteArray()

inheritDoc

		byte result[]=new byte[pos];
		System.arraycopy(buf,0,result,0,pos);
		return result;
	
public voidwrite(byte[] arg0)

inheritDoc

	  
	    
		int newPos=pos+arg0.length;
		if (newPos>size) {
			expandSize();
		}
		System.arraycopy(arg0,0,buf,pos,arg0.length);
		pos=newPos;
	
public voidwrite(byte[] arg0, int arg1, int arg2)

inheritDoc

		int newPos=pos+arg2;
		if (newPos>size) {
			expandSize();
		}
		System.arraycopy(arg0,arg1,buf,pos,arg2);
		pos=newPos;
	
public voidwrite(int arg0)

inheritDoc

		
		if (pos>=size) {
			expandSize();
		}
		buf[pos++]=(byte)arg0;