Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 53949177

Přidáno uživatelem Jan Havlíček před asi 4 roky(ů)

#re#7831 Indetation OK, format OK

Zobrazit rozdíly:

project/Deserializer/bcha.json
4 4
		"testInt" : 123, 
5 5
		"intArray" : [ 5, 10, 15 ], 
6 6
		"locInnerClassInstance" : {
7
		class samples.ok.Inner : {
8
			"vnitrni" : "INNER STRING AM I"
9
		}
10
}, 
7
			class samples.ok.Inner : {
8
				"vnitrni" : "INNER STRING AM I"
9
			}
10
		}, 
11 11
		"localEnum" : LOW, 
12 12
		"pozdrav" : "AHOJ", 
13 13
		"stringArray" : [ "A", "B", "C" ]
project/Deserializer/src/Converter.java
1 1
import java.io.File;
2
import java.io.FileDescriptor;
3
import java.io.FileOutputStream;
2 4
import java.io.IOException;
5
import java.io.OutputStream;
6
import java.io.PrintStream;
3 7
import java.util.List;
4 8

  
5 9
import jdeserialize.content;
......
46 50
		String json = "";
47 51
		try {
48 52
			System.out.println("Deserialization begins.");
53

  
54
			//Redirectovany system.out do null streamu. Mozno redirect do souboru
55
			System.setOut(new PrintStream(OutputStream.nullOutputStream()));
56
			System.out.println("TEST STRING NOT SHOWING");
49 57
			jdeserialize deserializer = new jdeserialize(buffer);
58
			System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
50 59
			
51 60
			// gets the "contents" into an array - returnes the deserialization of all
52 61
            // 'writes' into serialized object via objectOutputStream
......
59 68
			{
60 69
				if(cnt != null)
61 70
				{
71
					//Parametrizovany toJson pomoci dictionary
72
					//replace VS parametr
73
					//Pustit 2X s parametrem nenabori vnitrni data (kde muzou byt html znacky)
74
					//Ciste HTML / Cisty JSON
62 75
					json += cnt.toJson("");
63 76
				}
64 77
			}
project/Deserializer/src/jdeserialize/instance.java
30 30
    {
31 31
        StringBuffer sb = new StringBuffer();
32 32
        String val = "";
33
        
34
        indentation += "\t";
33 35

  
34 36
        /*if (classdesc.getType() == contenttype.CLASSDESC && !instance.indentedClasses.contains(classdesc.name)) {*/
35
            indentation += "\t";
36 37
           /* instance.indentedClasses.add(classdesc.name);
37 38
        }*/
38 39

  
......
53 54
            //System.out.println(sb.toString());
54 55
        }
55 56
        sb.append(" : {"); // ending of first line
57
        
58
        indentation += "\t";
56 59
        //System.out.println(sb.toString());
57 60

  
58 61
        for (field f : classdesc.fields) {
......
70 73
                val = locVal.toString();
71 74
            }
72 75

  
73
            sb.append("\n\t").append(indentation);
76
            sb.append("\n").append(indentation);
74 77
            sb.append("\"").append(f.name).append("\"");
75 78
            sb.append(" : ");
76 79
            sb.append(val);
......
81 84
                //System.out.println(sb.toString());
82 85
            }
83 86
        }
87
        indentation = indentation.substring(0, indentation.length() - 1);
84 88

  
85
        sb.append("\n").append(indentation).append("}\n}");
89
        sb.append("\n").append(indentation).append("}\n");
90
        indentation = indentation.substring(0, indentation.length() - 1);
91
        sb.append(indentation).append("}");
86 92
        //System.out.println(sb.toString());
87 93

  
88 94
        /*if (classdesc.getType() == contenttype.CLASSDESC && instance.indentedClasses.contains(classdesc.name)) {*/
89
            indentation.replaceFirst("\t", "");
95
        
90 96
            /*instance.indentedClasses.remove(classdesc.name);
91 97
        }*/
92 98

  

Také k dispozici: Unified diff