Codota Logo
JarURLConnectionImpl
Code IndexAdd Codota to your IDE (free)

How to use
JarURLConnectionImpl
in
libcore.net.url

Best Java code snippets using libcore.net.url.JarURLConnectionImpl (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: robovm/robovm

/**
 * Returns a connection to the jar file pointed by this <code>URL</code>
 * in the file system
 *
 * @return java.net.URLConnection A connection to the resource pointed by
 *         this url.
 * @param u
 *            java.net.URL The URL to which the connection is pointing to
 *
 * @throws IOException
 *             thrown if an IO error occurs when this method tries to
 *             establish connection.
 */
@Override
protected URLConnection openConnection(URL u) throws IOException {
  return new JarURLConnectionImpl(u);
}
origin: robovm/robovm

String entryName = getEntryName();
  cType = guessContentTypeFromName(entryName);
} else {
  try {
    connect();
    cType = jarFileURLConnection.getContentType();
  } catch (IOException ioe) {
origin: robovm/robovm

/**
 * @see java.net.URLConnection#connect()
 */
@Override
public void connect() throws IOException {
  if (!connected) {
    findJarFile(); // ensure the file can be found
    findJarEntry(); // ensure the entry, if any, can be found
    connected = true;
  }
}
origin: robovm/robovm

/**
 * Returns the content length of the resource. Test cases reveal that if the
 * URL is referring to a Jar file, this method answers a content-length
 * returned by URLConnection. For jar entry it should return it's size.
 * Otherwise, it will return -1.
 *
 * @return the content length
 */
@Override
public int getContentLength() {
  try {
    connect();
    if (jarEntry == null) {
      return jarFileURLConnection.getContentLength();
    }
    return (int) getJarEntry().getSize();
  } catch (IOException e) {
    // Ignored
  }
  return -1;
}
origin: robovm/robovm

/**
 * Returns the Jar file referred by this {@code URLConnection}.
 *
 * @throws IOException
 *             thrown if an IO error occurs while connecting to the
 *             resource.
 */
@Override
public JarFile getJarFile() throws IOException {
  connect();
  return jarFile;
}
origin: robovm/robovm

/**
 * Returns the Jar file referred by this {@code URLConnection}
 *
 * @throws IOException
 *             if an IO error occurs while connecting to the resource.
 */
private void findJarFile() throws IOException {
  if (getUseCaches()) {
    synchronized (jarCache) {
      jarFile = jarCache.get(jarFileURL);
    }
    if (jarFile == null) {
      JarFile jar = openJarFile();
      synchronized (jarCache) {
        jarFile = jarCache.get(jarFileURL);
        if (jarFile == null) {
          jarCache.put(jarFileURL, jar);
          jarFile = jar;
        } else {
          jar.close();
        }
      }
    }
  } else {
    jarFile = openJarFile();
  }
  if (jarFile == null) {
    throw new IOException();
  }
}
origin: robovm/robovm

  @Override
  public void close() throws IOException {
    super.close();
    if (!getUseCaches()) {
      closed = true;
      jarFile.close();
    }
  }
}
origin: robovm/robovm

/**
 * @param url
 *            the URL of the JAR
 * @throws MalformedURLException
 *             if the URL is malformed
 * @throws IOException
 *             if there is a problem opening the connection.
 */
public JarURLConnectionImpl(URL url) throws MalformedURLException, IOException {
  super(url);
  jarFileURL = getJarFileURL();
  jarFileURLConnection = jarFileURL.openConnection();
}
origin: robovm/robovm

/**
 * Look up the JarEntry of the entry referenced by this {@code
 * URLConnection}.
 */
private void findJarEntry() throws IOException {
  if (getEntryName() == null) {
    return;
  }
  jarEntry = jarFile.getJarEntry(getEntryName());
  if (jarEntry == null) {
    throw new FileNotFoundException(getEntryName());
  }
}
origin: robovm/robovm

/**
 * Returns the JarEntry of the entry referenced by this {@code
 * URLConnection}.
 *
 * @return the JarEntry referenced
 *
 * @throws IOException
 *             if an IO error occurs while getting the entry
 */
@Override
public JarEntry getJarEntry() throws IOException {
  connect();
  return jarEntry;
}
origin: MobiVM/robovm

/**
 * Returns the content length of the resource. Test cases reveal that if the
 * URL is referring to a Jar file, this method answers a content-length
 * returned by URLConnection. For jar entry it should return it's size.
 * Otherwise, it will return -1.
 *
 * @return the content length
 */
@Override
public int getContentLength() {
  try {
    connect();
    if (jarEntry == null) {
      return jarFileURLConnection.getContentLength();
    }
    return (int) getJarEntry().getSize();
  } catch (IOException e) {
    // Ignored
  }
  return -1;
}
origin: MobiVM/robovm

/**
 * Returns the Jar file referred by this {@code URLConnection}
 *
 * @throws IOException
 *             if an IO error occurs while connecting to the resource.
 */
private void findJarFile() throws IOException {
  if (getUseCaches()) {
    synchronized (jarCache) {
      jarFile = jarCache.get(jarFileURL);
    }
    if (jarFile == null) {
      JarFile jar = openJarFile();
      synchronized (jarCache) {
        jarFile = jarCache.get(jarFileURL);
        if (jarFile == null) {
          jarCache.put(jarFileURL, jar);
          jarFile = jar;
        } else {
          jar.close();
        }
      }
    }
  } else {
    jarFile = openJarFile();
  }
  if (jarFile == null) {
    throw new IOException();
  }
}
origin: ibinti/bugvm

  @Override
  public void close() throws IOException {
    super.close();
    if (!getUseCaches()) {
      closed = true;
      jarFile.close();
    }
  }
}
origin: MobiVM/robovm

/**
 * @param url
 *            the URL of the JAR
 * @throws MalformedURLException
 *             if the URL is malformed
 * @throws IOException
 *             if there is a problem opening the connection.
 */
public JarURLConnectionImpl(URL url) throws MalformedURLException, IOException {
  super(url);
  jarFileURL = getJarFileURL();
  jarFileURLConnection = jarFileURL.openConnection();
}
origin: MobiVM/robovm

/**
 * Look up the JarEntry of the entry referenced by this {@code
 * URLConnection}.
 */
private void findJarEntry() throws IOException {
  if (getEntryName() == null) {
    return;
  }
  jarEntry = jarFile.getJarEntry(getEntryName());
  if (jarEntry == null) {
    throw new FileNotFoundException(getEntryName());
  }
}
origin: MobiVM/robovm

String entryName = getEntryName();
  cType = guessContentTypeFromName(entryName);
} else {
  try {
    connect();
    cType = jarFileURLConnection.getContentType();
  } catch (IOException ioe) {
origin: ibinti/bugvm

/**
 * @see java.net.URLConnection#connect()
 */
@Override
public void connect() throws IOException {
  if (!connected) {
    findJarFile(); // ensure the file can be found
    findJarEntry(); // ensure the entry, if any, can be found
    connected = true;
  }
}
origin: robovm/robovm

/**
 * Creates an input stream for reading from this URL Connection.
 *
 * @return the input stream
 *
 * @throws IOException
 *             if an IO error occurs while connecting to the resource.
 */
@Override
public InputStream getInputStream() throws IOException {
  if (closed) {
    throw new IllegalStateException("JarURLConnection InputStream has been closed");
  }
  connect();
  if (jarInput != null) {
    return jarInput;
  }
  if (jarEntry == null) {
    throw new IOException("Jar entry not specified");
  }
  return jarInput = new JarURLConnectionInputStream(jarFile
      .getInputStream(jarEntry), jarFile);
}
origin: ibinti/bugvm

/**
 * Returns the content length of the resource. Test cases reveal that if the
 * URL is referring to a Jar file, this method answers a content-length
 * returned by URLConnection. For jar entry it should return it's size.
 * Otherwise, it will return -1.
 *
 * @return the content length
 */
@Override
public int getContentLength() {
  try {
    connect();
    if (jarEntry == null) {
      return jarFileURLConnection.getContentLength();
    }
    return (int) getJarEntry().getSize();
  } catch (IOException e) {
    // Ignored
  }
  return -1;
}
origin: ibinti/bugvm

/**
 * Returns the Jar file referred by this {@code URLConnection}
 *
 * @throws IOException
 *             if an IO error occurs while connecting to the resource.
 */
private void findJarFile() throws IOException {
  if (getUseCaches()) {
    synchronized (jarCache) {
      jarFile = jarCache.get(jarFileURL);
    }
    if (jarFile == null) {
      JarFile jar = openJarFile();
      synchronized (jarCache) {
        jarFile = jarCache.get(jarFileURL);
        if (jarFile == null) {
          jarCache.put(jarFileURL, jar);
          jarFile = jar;
        } else {
          jar.close();
        }
      }
    }
  } else {
    jarFile = openJarFile();
  }
  if (jarFile == null) {
    throw new IOException();
  }
}
libcore.net.urlJarURLConnectionImpl

Javadoc

This subclass extends URLConnection.

This class is responsible for connecting and retrieving resources from a Jar file which can be anywhere that can be referred to by an URL.

Most used methods

  • <init>
  • connect
  • findJarEntry
    Look up the JarEntry of the entry referenced by this URLConnection.
  • findJarFile
    Returns the Jar file referred by this URLConnection
  • getEntryName
  • getJarEntry
    Returns the JarEntry of the entry referenced by this URLConnection.
  • getJarFileURL
  • getUseCaches
  • guessContentTypeFromName
  • openJarFile

Popular in Java

  • Making http post requests using okhttp
  • addToBackStack (FragmentTransaction)
  • getSystemService (Context)
  • putExtra (Intent)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • BigInteger (java.math)
    Immutable arbitrary-precision integers. All operations behave as if BigIntegers were represented in
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Locale (java.util)
    A Locale object represents a specific geographical, political, or cultural region. An operation that
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now