private synchronized void loadAppendBuffer() throws IOException {
    if (myNextChunkBuffer != null) return;

    Path tempAppendFile = getIncompleteChunkFile();
    if (Files.exists(tempAppendFile)) {
      myBufferPosition = (int)Files.size(tempAppendFile);
      myNextChunkBuffer = new byte[calcBufferSize(myBufferPosition)];

      try (InputStream stream = Files.newInputStream(tempAppendFile)) {
        int n = 0;
        while (n < myBufferPosition) {
          int count = stream.read(myNextChunkBuffer, n, myBufferPosition - n);
          if (count < 0) break;
          n += count;
        }
      }
    }
    else {
      myBufferPosition = 0;
      myNextChunkBuffer = new byte[MIN_APPEND_BUFFER_LENGTH];
    }
  }
private synchronized void loadAppendBuffer()