/* Serialized bytes array -- BytesArrayContainer.java */
/** By Frank Bellegarde on 01-07-12 */
/** Email: mr_spock@altavista.com */

public class BytesArrayContainer extends java.lang.Object implements java.io.Externalizable {
    
    
    protected byte b[];
    protected int n=0;
    
    /** Creates new BytesArrayContainer */
    public BytesArrayContainer() {
        b = new byte[0];
    }
    
    /** Detailed constructeur */
    public BytesArrayContainer(byte[] _b){
        b = new byte[_b.length];
        b = _b;
        n = b.length;
    }
    
    public byte[] getValue(){
        return b;
    }
    
    public int getSize(){
        return n;
    }
    
    public void setValue(byte[] _b){
        b = new byte[_b.length];
        b = _b;
        n = b.length;
    }
    
  /** java.io.Eternalizable interface */  
    public void readExternal(java.io.ObjectInput p1) throws java.io.IOException, java.lang.ClassNotFoundException {
        n = p1.readInt();
        b = new byte[n];
        for(int i = 0; i < n; i++) b[i] = p1.readByte();
    }
    
    public void writeExternal(java.io.ObjectOutput p1) throws java.io.IOException {
        p1.writeInt(n);
        p1.write(b);
    }
    
}
