public void testWriteOffset(){
  int len=200;
  int dataLen=100;
  byte[] srcData=getWData(dataLen);
  byte[] data=new byte[dataLen];
  int nOffset=10;
  ByteFifoBuffer instance=new ByteFifoBuffer(len);
  int result=instance.writeOffset(srcData,dataLen,nOffset);
  int readCount=instance.readOffset(data,0,dataLen,nOffset);
  assertEquals(result,readCount);
  assertArrayEquals(srcData,data);
  byte[] halfFilled=new byte[dataLen * 2];
  System.arraycopy(srcData,0,halfFilled,dataLen,dataLen);
  byte[] halfFilledRead=new byte[dataLen * 2];
  instance.readOffset(halfFilledRead,dataLen,dataLen,nOffset);
  assertArrayEquals(halfFilled,halfFilledRead);
  instance=new ByteFifoBuffer(len);
  instance.write(srcData,dataLen);
  instance.write(srcData,dataLen / 2);
  instance.read(data,dataLen);
  instance.writeOffset(srcData,dataLen,50);
  instance=new ByteFifoBuffer(61440);
  instance.writeOffset(getWData(1384),1384,31832);
}

public void testWriteOffset ( ) { int len = 200 ; int dataLen = 100 ; byte [ ] srcData = getWData ( dataLen ) ; byte [ ] data = new byte [ dataLen ] ; int nOffset = 10 ; ByteFifoBuffer instance = new ByteFifoBuffer ( len ) ; int result = instance . writeOffset ( srcData , dataLen , nOffset ) ; int readCount = instance . readOffset ( data , 0 , dataLen , nOffset ) ; assertEquals ( result , readCount ) ; assertArrayEquals ( srcData , data ) ; byte [ ] halfFilled = new byte [ dataLen * 2 ] ; System . arraycopy ( srcData , 0 , halfFilled , dataLen , dataLen ) ; byte [ ] halfFilledRead = new byte [ dataLen * 2 ] ; instance . readOffset ( halfFilledRead , dataLen , dataLen , nOffset ) ; assertArrayEquals ( halfFilled , halfFilledRead ) ; instance = new ByteFifoBuffer ( len ) ; instance . write ( srcData , dataLen ) ; instance . write ( srcData , dataLen / 2 ) ; instance . read ( data , dataLen ) ; instance . writeOffset ( srcData , dataLen , 50 ) ; instance = new ByteFifoBuffer ( 61440 ) ; instance . writeOffset ( getWData ( 1384 ) , 1384 , 31832 ) ; }
test of writeoffset method , of class bytefifobuffer .
