Revize 5c81df14
Přidáno uživatelem Jan Havlíček před více než 4 roky(ů)
demo_jh/Deserializer_tests/src/app/App.java | ||
---|---|---|
16 | 16 |
* When they are |
17 | 17 |
* **/ |
18 | 18 |
public static void main(String[] args) throws Exception |
19 |
{ |
|
20 |
App thisApp = new App(); |
|
21 |
|
|
22 |
//thisApp.pureSerializationDeserialization(); |
|
23 |
|
|
24 |
//https://code.google.com/archive/p/jdeserialize/wikis/Documentation.wiki |
|
25 |
String[] myArgs= new String[1]; |
|
26 |
myArgs[0] = "serialized/simple.out"; |
|
27 |
//testing call without any options. Outputs the deserialized data into console. |
|
28 |
jdeserialize.jdeserialize.main(myArgs); |
|
29 |
} |
|
30 |
|
|
31 |
|
|
32 |
private void pureSerializationDeserialization() |
|
19 | 33 |
{ |
20 | 34 |
try{ |
21 | 35 |
System.out.println("Starting..."); |
22 | 36 |
|
23 |
App thisApp = new App(); |
|
24 |
//thisApp.Serialize(new SampleClassesOK.Simple(), "serialized/simple.out"); |
|
37 |
this.serialize(new samples.ok.Simple(), "serialized/simple.out"); |
|
25 | 38 |
|
26 |
SampleClassesOK.Simple test1 = thisApp.Deserialize("serialized/simple.out");
|
|
39 |
samples.nok.Simple test1 = this.deserialize("serialized/simple.out");
|
|
27 | 40 |
|
28 | 41 |
}catch(Exception e) |
29 | 42 |
{ |
... | ... | |
32 | 45 |
} |
33 | 46 |
} |
34 | 47 |
|
35 |
private <T> T Deserialize(String inputFilePath) |
|
48 |
/** |
|
49 |
* Standard way of deserializing objects with java. |
|
50 |
* |
|
51 |
* Taken from example method, doc |
|
52 |
**/ |
|
53 |
private <T> T deserialize(String inputFilePath) |
|
36 | 54 |
{ |
37 | 55 |
try |
38 | 56 |
{ |
... | ... | |
60 | 78 |
* |
61 | 79 |
* Taken from example method, doc |
62 | 80 |
**/ |
63 |
private void Serialize(Object obj, String outputPath)
|
|
81 |
private void serialize(Object obj, String outputPath)
|
|
64 | 82 |
{ |
65 | 83 |
try |
66 | 84 |
{ |
Také k dispozici: Unified diff
#7768 Simplified jdeserialize main with args. Project implemented