granulepos += (mode==0 ? 160 : 320);
granulepos += nframes * (mode==2 ? 640 : (mode==1 ? 320 : 160));
  public void writePacket(byte[] data, int offset, int len)    throws IOException   {    if (len <= 0) { // nothing to write      return;    }    if (packetCount > 250) { // this mustn't go beyond 255      flush(false);    }    System.arraycopy(data, offset, dataBuffer, dataBufferPtr, len);    dataBufferPtr += len;    headerBuffer[headerBufferPtr++]=(byte)len;    packetCount++;    granulepos += (mode==0 ? 160 : 320);  }