判断是不是通过外部设置 url 来的 AVFile

@param avFile
@return
541665
static boolean isExternalAVFile(AVFile avFile) {
    return null != avFile
            && null != avFile.getMetaData()
            && avFile.getMetaData().containsKey("__source")
            && avFile.getMetaData().get("__source").equals("external");
  }
573323
public static String getFilename(final URL url) throws UnsupportedEncodingException
	{
		if (isJar(url) || isEar(url))
		{
			String fileName = URLDecoder.decode(url.getFile(), "UTF-8");
			fileName = fileName.substring(5, fileName.indexOf("!"));
			return fileName;
		}
		return URLDecoder.decode(url.getFile(), "UTF-8");
	}
881490
@Override
    public StorePath uploadImage(FastImageFile fastImageFile) {
        String fileExtName = fastImageFile.getFileExtName();
        Validate.notNull(fastImageFile.getInputStream(), "上传文件流不能为空");
        Validate.notBlank(fileExtName, "文件扩展名不能为空");
        // 检查是否能处理此类图片
        if (!isSupportImage(fileExtName)) {
            throw new FdfsUnsupportImageTypeException("不支持的图片格式" + fileExtName);
        }
        // 获取存储节点
        StorageNode client = getStorageNode(fastImageFile.getGroupName());
        byte[] bytes = inputStreamToByte(fastImageFile.getInputStream());

        // 上传文件和metaDataSet
        StorePath path = uploadFileAndMetaData(client, new ByteArrayInputStream(bytes),
                fastImageFile.getFileSize(), fileExtName,
                fastImageFile.getMetaDataSet());

        //如果设置了需要上传缩略图
        if (null != fastImageFile.getThumbImage()) {
            // 上传缩略图
            uploadThumbImage(client, new ByteArrayInputStream(bytes), path.getPath(), fastImageFile);
        }
        bytes = null;
        return path;
    }
222437
public static byte[] getBytesFromHttp(String httpFileURL) throws IOException {

        InputStream bufferedInputStream = null;
        try {
            bufferedInputStream = getInputStreamFromHttp(httpFileURL);
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            byte[] buffer = new byte[BUFFER_SIZE];
            for (int len = 0; (len = bufferedInputStream.read(buffer)) != -1;) {
                byteArrayOutputStream.write(buffer, 0, len);
            }
            byte[] arrayOfByte1 = byteArrayOutputStream.toByteArray();
            return arrayOfByte1;
        } finally {
            if (bufferedInputStream != null)
                bufferedInputStream.close();
        }
    }
1334945
public static String getVersion(String reportFile) {
		try {
			String text = readAsString(reportFile);
			return getVersionFromText(text);
		} catch (IOException e) {
			LOG.error(e.getMessage(), e);
			return null;
		}
	}
574632
static DBaseFileAttributePool getPool(URL dbaseFile) {
		DBaseFileAttributePool pool = null;
		if (dbaseFile != null) {
			if (pools == null) {
				pools = new WeakValueTreeMap<>();
			}
			pool = pools.get(dbaseFile.toExternalForm());
			if (pool == null) {
				pool = new DBaseFileAttributePool(dbaseFile);
				pools.put(dbaseFile.toExternalForm(), pool);
			}
		}
		return pool;
	}
1018686
public static String encodeBase64(File imageFile) throws IOException{
        BufferedImage bi = ImageIO.read(imageFile);
        String type = FileKit.getFileExtension(imageFile).toLowerCase();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ImageIO.write(bi,type, baos);
        return Base64Kit.encode(baos.toByteArray());
    }
643470
public String downloadFileFromServer(String url, String fileName, String targetFileDir) throws Exception {

        // 下载的路径
        String localDir = getLocalDownloadDirPath();

        // 设置远程地址
        RemoteUrl remoteUrl = new RemoteUrl(url, hostList);

        // 下载
        return restfulMgr
                .downloadFromServer(remoteUrl, fileName, localDir, localDownloadDirTemp, targetFileDir,
                        enableLocalDownloadDirInClassPath,
                        retryTime,
                        retrySleepSeconds);

    }
1257581
public static URL getURL(File file) {
		Assert.notNull(file, "File is null !");
		try {
			return file.toURI().toURL();
		} catch (MalformedURLException e) {
			throw new UtilException(e, "Error occured when get URL!");
		}
	}
1076448
public static String getUrl(Object o) {
        if ( o instanceof VerifierRule ) {
            VerifierRule rule = (VerifierRule) o;
            return getRuleUrl( UrlFactory.RULE_FOLDER,
                               rule.getPath(),
                               rule.getName() );
        }

        return o.toString();
    }
727940
public static URL correct(final File file) throws MalformedURLException {
        if (file == null) {
            throw new MalformedURLException("The url is null");
        }
        return new URL(correct(file.toURI().toString(), true));
    }
366657
public static int getDuration(File flvFile) {
        int duration = 0;
        RandomAccessFile flv = null;
        try {
            flv = new RandomAccessFile(flvFile, "r");
            long flvLength = Math.max(flvFile.length(), flv.length());
            log.debug("File length: {}", flvLength);
            if (flvLength > 13) {
                flv.seek(flvLength - 4);
                int lastTagSize = flv.readInt();
                log.debug("Last tag size: {}", lastTagSize);
                if (lastTagSize > 0 && (lastTagSize < flvLength)) {
                    // jump right to where tag timestamp would be
                    flv.seek(flvLength - lastTagSize);
                    // grab timestamp as a regular int
                    duration = flv.readInt();
                    // adjust value to match extended timestamp
                    duration = (duration >>> 8) | ((duration & 0x000000ff) << 24);
                } else {
                    // attempt to read the metadata
                    flv.seek(13);
                    byte tagType = flv.readByte();
                    if (tagType == ITag.TYPE_METADATA) {
                        ByteBuffer buf = ByteBuffer.allocate(3);
                        flv.getChannel().read(buf);
                        int bodySize = IOUtils.readMediumInt(buf);
                        log.debug("Metadata body size: {}", bodySize);
                        flv.skipBytes(4); // timestamp
                        flv.skipBytes(3); // stream id
                        buf.clear();
                        buf = ByteBuffer.allocate(bodySize);
                        flv.getChannel().read(buf);
                        // construct the meta
                        IoBuffer ioBuf = IoBuffer.wrap(buf);
                        Input input = new Input(ioBuf);
                        String metaType = Deserializer.deserialize(input, String.class);
                        log.debug("Metadata type: {}", metaType);
                        Map<String, ?> meta = Deserializer.deserialize(input, Map.class);
                        Object tmp = meta.get("duration");
                        if (tmp != null) {
                            if (tmp instanceof Double) {
                                duration = ((Double) tmp).intValue();
                            } else {
                                duration = Integer.valueOf((String) tmp);
                            }
                        }
                        input = null;
                        meta.clear();
                        meta = null;
                        ioBuf.clear();
                        ioBuf.free();
                        ioBuf = null;
                    }
                }
            }
        } catch (IOException e) {
            log.warn("Exception getting file duration", e);
        } finally {
            try {
                if (flv != null) {
                    flv.close();
                }
            } catch (IOException e) {
            }
            flv = null;
        }
        return duration;
    }
659388
static RegistryEntry getEntry(VirtualFile virtualFile) {
        if (virtualFile == null) {
            throw MESSAGES.nullArgument("VirutalFile");
        }
        return rootEntry.find(virtualFile);
    }
1006176
public String getURL()
  {
    if (! isWindows())
      return escapeURL("file:" + getFullPath());

    String path = getFullPath();
    int length = path.length();
    CharBuffer cb = new CharBuffer();

    // #2725, server/1495
    cb.append("file:");

    char ch;
    int offset = 0;
    // For windows, convert /c: to c:
    if (length >= 3
        && path.charAt(0) == '/'
        && path.charAt(2) == ':'
        && ('a' <= (ch = path.charAt(1)) && ch <= 'z'
            || 'A' <= ch && ch <= 'Z')) {
      // offset = 1;
    }
    else if (length >= 3
             && path.charAt(0) == '/'
             && path.charAt(1) == ':'
             && path.charAt(2) == '/') {
      cb.append('/');
      cb.append('/');
      cb.append('/');
      cb.append('/');
      offset = 3;
    }

    for (; offset < length; offset++) {
      ch = path.charAt(offset);

      if (ch == '\\')
        cb.append('/');
      else
        cb.append(ch);
    }

    return escapeURL(cb.toString());

  }
1039512
public static URL convertFileToURL( String filePath ) throws MalformedURLException {
        CheckArg.isNotEmpty(filePath, "filePath");
        File file = new File(filePath.trim());
        return file.toURI().toURL();
    }
613721
private static void encodeImg(String desFile, BufferedImage desImg, Float quality) {
        FileOutputStream out = null;
        try {
            if (quality != null) {
                if (quality > 1.0 || quality < 0.0) {
                    throw new Exception("quality参数指定值不正确");
                }
            }
            out = new FileOutputStream(desFile);
            //图片采用JPEG格式编码
            JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
            if (quality != null) {
                //编码参数
                JPEGEncodeParam jep = JPEGCodec.getDefaultJPEGEncodeParam(desImg);
                //设置压缩质量
                jep.setQuality(quality, true);
                //开始编码并输出
                encoder.encode(desImg, jep);
            } else {
                //开始编码并输出
                encoder.encode(desImg);
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            CommonUtils.closeIOStream(null, out);
        }
    }
768728
public static JarFile getJarFile(URL url) {
		try {
			JarURLConnection urlConnection = (JarURLConnection) url.openConnection();
			return urlConnection.getJarFile();
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}