public int append(double[] buffer, int start, int len) throws IllegalArgumentException, IOException
  {
    int bytesRead = 0;
    int bytesToRead = 0;

    //check start and len
    if(start < 0 || len < 0)
      throw new IllegalArgumentException("start and len must be positiv values");

    //check the buffer size
    if(buffer == null || buffer.length - start < len)
      throw new IllegalArgumentException("Specified buffer is too samll to hold all samples.");

    //compute byte to read
    bytesToRead = len * frameSize;

    //read new data from inputstream
    bytesRead = read(bytesToRead);

    //now append new data
    convertToDouble(inputBuffer, bytesRead, buffer, start);

    return bytesRead/frameSize;
  }