Java JarURLConnection .getMainAttributes ()

Syntax

JarURLConnection.getMainAttributes() has the following syntax.

public Attributes getMainAttributes()    throws IOException

Example

In the following code shows how to use JarURLConnection.getMainAttributes() method.


import java.net.JarURLConnection;
import java.net.URL;
import java.util.jar.Attributes;
//from w  w w. ja v  a2 s .c o m
public class Main {
  public static void main(String[] argv) throws Exception {
    URL url = new URL("jar:file:/c://my.jar!/");
    JarURLConnection conn = (JarURLConnection) url.openConnection();

    Attributes attrs = conn.getMainAttributes();
    System.out.println(attrs.isEmpty());
  }
}




















Home »
  Java Tutorial »
    java.net »




CookieManager
CookiePolicy
CookieStore
DatagramPacket
DatagramSocket
HttpCookie
HttpURLConnection
InetAddress
JarURLConnection
MulticastSocket
ServerSocket
Socket
SocketAddress
URI
URL
URLConnection
URLDecoder
URLEncoder