GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — JavaGeneric/JavaGenMUB8.java at main · AvinandanBose/JavaGeneric Expand file tree/ Copy pathJavaGenMUB8.javaMore file actions 60 lines (51 loc) · 1.7 KB / Copy pathJavaGenMUB8.javaFile metadata and controls60 lines (51 loc) · 1.7 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; public class JavaGenMUB8<T extends Number & Serializable> { T path; T name; public JavaGenMUB8(T path) { this.path = path; } public T serialize(T name) { this.name = name; try { File f = new File(path.toString()); FileOutputStream file = new FileOutputStream(f); ObjectOutputStream out = new ObjectOutputStream(file); out.writeObject(name); System.out.println("Object has been successfully serialized... "); out.close(); file.close(); } catch (IOException e) { e.printStackTrace(); } return null; } public T deserialize() { try { File f = new File(path.toString()); FileInputStream file = new FileInputStream(f); ObjectInputStream in = new ObjectInputStream(file); T name1 = (T) in.readObject(); System.out.println("name1 = " + name1); System.out.println("Object has been successfully deserialized... "); in.close(); file.close(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } return null; } public static void main(String[] args) { JavaGenMUB8<Integer> obj = new JavaGenMUB8<>(10); obj.serialize(100); obj.deserialize(); } } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |