List of usage examples for java.util Enumeration nextElement
E nextElement();
From source file:Main.java
public static void main(String args[]) { ProtectionDomain domain = "".getClass().getProtectionDomain(); PermissionCollection pcoll = Policy.getPolicy().getPermissions(domain); Enumeration e = pcoll.elements(); for (; e.hasMoreElements();) { Permission p = (Permission) e.nextElement(); System.out.println(p);// w w w .j a v a2s . com } }
From source file:MainClass.java
public static void main(String[] args) throws IOException { ZipFile zf = new ZipFile(args[0]); Enumeration e = zf.entries(); while (e.hasMoreElements()) { ZipEntry ze = (ZipEntry) e.nextElement(); System.out.println("Unzipping " + ze.getName()); FileOutputStream fout = new FileOutputStream(ze.getName()); InputStream in = zf.getInputStream(ze); for (int c = in.read(); c != -1; c = in.read()) { fout.write(c);// w ww . ja v a2 s . c om } in.close(); fout.close(); } }
From source file:Main.java
public static void main(String[] args) throws IOException { JarFile jf = new JarFile(args[0]); Enumeration e = jf.entries(); while (e.hasMoreElements()) { JarEntry je = (JarEntry) e.nextElement(); String name = je.getName(); Date lastModified = new Date(je.getTime()); long uncompressedSize = je.getSize(); long compressedSize = je.getCompressedSize(); System.out.println(lastModified); System.out.println(uncompressedSize); System.out.println(compressedSize); }//w ww . j av a2s. c om }
From source file:Main.java
public static void main(String[] args) { Hashtable<String, String> ht = new Hashtable<String, String>(); ht.put("1", "One"); ht.put("2", "Two"); ht.put("3", "Three"); Collection c = ht.values();/*w w w . j ava 2s . c om*/ Iterator itr = c.iterator(); while (itr.hasNext()) { System.out.println(itr.next()); } c.remove("One"); Enumeration e = ht.elements(); while (e.hasMoreElements()) { System.out.println(e.nextElement()); } }
From source file:Main.java
public static void main(String[] args) throws IOException { JarFile jf = new JarFile(args[0]); Enumeration e = jf.entries(); while (e.hasMoreElements()) { JarEntry je = (JarEntry) e.nextElement(); String name = je.getName(); Attributes a = je.getAttributes(); if (a != null) { Object[] nameValuePairs = a.entrySet().toArray(); for (int j = 0; j < nameValuePairs.length; j++) { System.out.println(nameValuePairs[j]); }//from w w w.j a v a 2s.c o m } } }
From source file:Main.java
public static void main(String[] argv) throws Exception { FileInputStream is = new FileInputStream("yourfile" + ".keystore"); KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); String password = "my-keystore-password"; keystore.load(is, password.toCharArray()); Enumeration e = keystore.aliases(); for (; e.hasMoreElements();) { String alias = (String) e.nextElement(); boolean b = keystore.isKeyEntry(alias); b = keystore.isCertificateEntry(alias); }/*w w w .ja v a 2 s . c o m*/ is.close(); }
From source file:Main.java
public static void main(String[] args) throws Exception { ZipFile zf = new ZipFile("your.zip"); Enumeration e = zf.entries(); while (e.hasMoreElements()) { ZipEntry ze = (ZipEntry) e.nextElement(); String name = ze.getName(); long crc = ze.getCrc(); System.out.println("Its CRC is " + crc); String comment = ze.getComment(); if (comment != null && !comment.equals("")) { System.out.println(comment); }// w ww. ja v a 2s . c o m if (ze.isDirectory()) { System.out.println(name + " is a directory"); } } }
From source file:collection.java
public static void main(String args[]) { Enumeration e = new collection(); while (e.hasMoreElements()) { System.out.println(e.nextElement()); }//from ww w. j av a 2s. c om }
From source file:Main.java
public static void main(String[] args) { HashSet<String> hashSet = new HashSet<String>(); hashSet.add("A"); hashSet.add("B"); hashSet.add("D"); hashSet.add("E"); hashSet.add("F"); Enumeration e = Collections.enumeration(hashSet); while (e.hasMoreElements()) System.out.println(e.nextElement()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTextPane textPane = new JTextPane(); DefaultStyledDocument doc = (DefaultStyledDocument) textPane.getDocument(); Enumeration e = doc.getStyleNames(); while (e.hasMoreElements()) { String styleName = (String) e.nextElement(); System.out.println(styleName); Style style = doc.getStyle(styleName); }/* ww w. j a va2 s . c om*/ }