anchor.diff:          IoList
       end.
   
  +%% @doc Returns a tuple where the first element contains the leading SplitAt
  +%% bytes of the original iolist, and the 2nd element is the tail. If SplitAt
  +%% is larger than byte_size(IoList), return the difference.
  +-spec split_iolist(IoList::iolist(), SplitAt::non_neg_integer(), Acc::list()) ->
  +    {iolist(), iolist()} | non_neg_integer().
   split_iolist(List, 0, BeginAcc) ->
       {lists:reverse(BeginAcc), List};
   split_iolist([], SplitAt, _BeginAcc) ->
  
positive.code:     Md5Sig = couch_util:md5(HeaderBin),
      {ok, HeaderBin}.
  
  calculate_total_read_len(0, FinalLen) ->
      calculate_total_read_len(1, FinalLen) + 1;
  calculate_total_read_len(BlockOffset, FinalLen) ->
  
negative.code:     ok.
  
  
  handle_call({pread_iolist, Pos}, _From, File) ->
      {LenIolist, NextPos} = read_raw_iolist_int(File, Pos, 4),
      case iolist_to_binary(LenIolist) of
      <<1:1/integer,Len:31/integer>> -> % an MD5-prefixed term
          {Md5AndIoList, _} = read_raw_iolist_int(File, NextPos, Len+16),
          {Md5, IoList} = extract_md5(Md5AndIoList),
          case couch_util:md5(IoList) of
          Md5 ->
              {reply, {ok, IoList}, File};
          _ ->
              {stop, file_corruption, {error,file_corruption}, File}
          end;
      <<0:1/integer,Len:31/integer>> ->
          {Iolist, _} = read_raw_iolist_int(File, NextPos, Len),
          {reply, {ok, Iolist}, File} 
      end;
  handle_call({pread, Pos, Bytes}, _From, #file{fd=Fd,tail_append_begin=TailAppendBegin}=File) ->
      {ok, Bin} = file:pread(Fd, Pos, Bytes),
      {reply, {ok, Bin, Pos >= TailAppendBegin}, File};
  