Changeset 31:7fa2d7cbb87c in rrlib_serialization-java


Ignore:
Timestamp:
15.10.2017 22:48:59 (2 years ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Message:

Adapts to changes in rrlib_serialization and rrlib_rtti

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • BinaryInputStream.java

    r27 r31  
    892892                return deserializeTo; 
    893893            } 
    894         } else { 
    895             assert(encoding == Serialization.DataEncoding.XML); 
     894        } else if (encoding == Serialization.DataEncoding.XML) { 
    896895            XMLDocument d = new XMLDocument(new InputSource(new StringReader(readString())), false); 
    897896            XMLNode n = d.getRootNode(); 
    898897            return Serialization.deserialize(n, deserializeTo, type); 
     898        } else { 
     899            assert(encoding == Serialization.DataEncoding.NONE); 
     900            if (deserializeTo == null) { 
     901                deserializeTo = type.newInstance(); 
     902            } 
     903            return deserializeTo; 
    899904        } 
    900905    } 
  • BinaryOutputStream.java

    r26 r31  
    686686            writeString(""); 
    687687            writeObject(object, type); 
    688         } else { 
     688        } else if (encoding == Serialization.DataEncoding.BINARY_COMPRESSED) { 
    689689            assert(encoding == Serialization.DataEncoding.XML); 
    690690            XMLDocument d = new XMLDocument(); 
     
    697697                writeString("error generating XML code."); 
    698698            } 
     699        } else { 
     700            assert(encoding == Serialization.DataEncoding.NONE); 
    699701        } 
    700702    } 
  • Serialization.java

    r23 r31  
    4949 
    5050    /** Enum for different types of data encoding */ 
    51     public enum DataEncoding { BINARY, STRING, XML, BINARY_COMPRESSED } 
     51    public enum DataEncoding { BINARY, STRING, XML, BINARY_COMPRESSED, NONE } 
    5252 
    5353    /** int -> hex char */ 
Note: See TracChangeset for help on using the changeset viewer.