001package io.ebean.enhance.common;
002
003import java.io.IOException;
004import java.io.InputStream;
005import java.net.URL;
006import java.net.URLConnection;
007
008/**
009 * Helper to open URL content without file descriptor caching (by underlying JDK JarURLConnection).
010 */
011public class UrlHelper {
012
013  /**
014   * Open the URL content without using caching returning the resulting InputStream.
015   */
016  public static InputStream openNoCache(URL url) throws IOException {
017
018    URLConnection urlConnection = url.openConnection();
019    urlConnection.setUseCaches(false);
020    return urlConnection.getInputStream();
021  }
022}