protected byte[] validateByteArraySize(Buffer buffer,int newSize){
  byte[] typedArray=(byte[])buffer.getData();
  if (typedArray != null) {
    if (typedArray.length >= newSize) {
      return typedArray;
    }
    byte[] tempArray=new byte[newSize];
    System.arraycopy(typedArray,0,tempArray,0,typedArray.length);
    typedArray=tempArray;
  }
 else {
    typedArray=new byte[newSize];
  }
  buffer.setData(typedArray);
  return typedArray;
}

protected byte [ ] validateByteArraySize ( Buffer buffer , int newSize ) { byte [ ] typedArray = ( byte [ ] ) buffer . getData ( ) ; if ( typedArray != null ) { if ( typedArray . length >= newSize ) { return typedArray ; } byte [ ] tempArray = new byte [ newSize ] ; System . arraycopy ( typedArray , 0 , tempArray , 0 , typedArray . length ) ; typedArray = tempArray ; } else { typedArray = new byte [ newSize ] ; } buffer . setData ( typedArray ) ; return typedArray ; }
validate that the buffer ' s data size is at least newsize
