private InputStream getInputStreamInternal(File file, long start, long end, boolean refreshMeta) {
    try {
      FileMetaData fileInfo = fileToUriMap.get(file.getId());
      if (refreshMeta || (fileInfo == null || new Date().after(fileInfo.getExpires()))) {
        fileInfo = getFileContentInfo(file);
        fileToUriMap.put(file.getId(), fileInfo);
      }

      InputStream in =
          getClient()
              .resource(new URI(fileInfo.getHrefContent()))
              .accept(MediaType.APPLICATION_OCTET_STREAM)
              .accept(MediaType.TEXT_HTML)
              .accept(MediaType.APPLICATION_XHTML_XML)
              .header("Range", "bytes=" + start + "-" + end)
              .get(InputStream.class);
      return in;
    } catch (BaseSpaceException bs) {
      throw bs;
    } catch (Throwable t) {
      throw new RuntimeException(t);
    }
  }