@Override
    protected void writeFileEntry(String name, InputStream source, long length, long timestamp, int mode, @Nullable String symlinkTarget) throws IOException {
      TarArchiveEntry e;
      if (symlinkTarget == null) {
        e = new TarArchiveEntry(name);
      }
      else {
        e = new TarArchiveEntry(name, TarConstants.LF_SYMLINK);
        e.setLinkName(symlinkTarget);
        length = 0;
      }
      if (length < 0) {
        if (source instanceof ByteArrayInputStream || source instanceof UnsyncByteArrayInputStream) {
          length = source.available();
        }
        else {
          BufferExposingByteArrayOutputStream temp = new BufferExposingByteArrayOutputStream();
          StreamUtil.copy(source, temp);
          length = temp.size();
          source = new ByteArrayInputStream(temp.getInternalBuffer(), 0, temp.size());
        }
      }
      e.setSize(length);
      e.setModTime(timestamp);
      if (mode != 0) {
        e.setMode(mode);
      }
      myStream.putArchiveEntry(e);
      if (length > 0) {
        StreamUtil.copy(source, myStream);
      }
      myStream.closeArchiveEntry();
    }
@Override
    protected void writeFileEntry(String name, InputStream source, long length, long timestamp, int mode, @Nullable String symlinkTarget)