List of usage examples for java.util Enumeration hasMoreElements
boolean hasMoreElements();
From source file:Main.java
public static void main(String[] args) throws Exception { String zipname = "data.zip"; ZipFile zipFile = new ZipFile(zipname); Enumeration enumeration = zipFile.entries(); while (enumeration.hasMoreElements()) { ZipEntry zipEntry = (ZipEntry) enumeration.nextElement(); System.out.println(zipEntry.getExtra()); }//from w w w . j a v a 2 s. co m }
From source file:MainClass.java
public static void main(String args[]) throws Exception { Vector v = new Vector(Arrays.asList("a", "b", "c")); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(v);//ww w .jav a2 s . c o m oos.close(); ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); ObjectInputStream ois = new ObjectInputStream(bais); Vector v2 = (Vector) ois.readObject(); Enumeration e = v.elements(); while (e.hasMoreElements()) { System.out.println(e.nextElement()); } }
From source file:Main.java
public static void main(String[] args) throws Exception { ZipFile zipFile = new ZipFile("testfile.zip"); Enumeration zipEntries = zipFile.entries(); while (zipEntries.hasMoreElements()) { System.out.println(((ZipEntry) zipEntries.nextElement()).getName()); }// ww w . j a va2 s. 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 . j a v a2 s . c om } in.close(); fout.close(); } }
From source file:SaveVector.java
public static void main(String args[]) throws Exception { String data[] = { "Java", "Source", "and", "Support", "." }; Vector v = new Vector(Arrays.asList(data)); ByteArrayOutputStream b = new ByteArrayOutputStream(); ObjectOutputStream o = new ObjectOutputStream(b); o.writeObject(v);//from www . j ava 2s. c om o.close(); ByteArrayInputStream bb = new ByteArrayInputStream(b.toByteArray()); ObjectInputStream oo = new ObjectInputStream(bb); Vector v2 = (Vector) oo.readObject(); Enumeration e = v.elements(); while (e.hasMoreElements()) { System.out.println(e.nextElement()); } }
From source file:MainClass.java
public static void main(String[] args) { String data;// ww w . j a v a 2 s . c o m String msg; Hashtable h = new Hashtable(20); System.out.println(h.put("one", new Integer(1))); System.out.println(h.put("name", "A")); System.out.println(h.put("date", new Date())); System.out.println(h.put("one", new Integer(4))); Enumeration e = h.keys(); while (e.hasMoreElements()) System.out.println(e.nextElement()); e = h.elements(); while (e.hasMoreElements()) System.out.println(e.nextElement()); }
From source file:Main.java
public static void main(String[] args) throws Exception { ZipFile zipFile = new ZipFile(new File("testfile.zip"), ZipFile.OPEN_READ); Enumeration zipEntries = zipFile.entries(); while (zipEntries.hasMoreElements()) { System.out.println(((ZipEntry) zipEntries.nextElement()).getName()); }/* ww w. j a va 2s . c o m*/ }
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"); Object obj = ht.remove("2"); System.out.println(obj + " was Removed "); Enumeration e = ht.elements(); while (e.hasMoreElements()) { System.out.println(e.nextElement()); }/*from www. jav a 2 s . com*/ }
From source file:Main.java
public static void main(String[] args) throws Exception { ZipFile zipFile = new ZipFile(new File("testfile.zip")); Enumeration zipEntries = zipFile.entries(); while (zipEntries.hasMoreElements()) { System.out.println(((ZipEntry) zipEntries.nextElement()).getName()); }// w w w .j a v a2 s . c o m }
From source file:Main.java
public static void main(String[] args) throws Exception { // Prepare content for simulating property files String fileContent = "s1=1\n" + "s2=Main\n" + "s3=Fri Jan 31"; InputStream propStream = new StringBufferInputStream(fileContent); PropertyResourceBundle bundle = new PropertyResourceBundle(propStream); // Get resource keys Enumeration keys = bundle.getKeys(); while (keys.hasMoreElements()) { System.out.println("Bundle key: " + keys.nextElement()); }/* ww w .j av a2 s . c om*/ }