BUG-4626: Split out stream token types
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / datastore / node / utils / stream / NormalizedNodeOutputStreamWriter.java
index 9ff7457298ef3c43745d0b76ed21c6b19e1f3314..a266a2f2202904c190ca873fa7764709a767ecac 100644 (file)
@@ -45,13 +45,6 @@ public class NormalizedNodeOutputStreamWriter implements NormalizedNodeStreamWri
 
     private static final Logger LOG = LoggerFactory.getLogger(NormalizedNodeOutputStreamWriter.class);
 
-    static final byte SIGNATURE_MARKER = (byte) 0xab;
-    static final short CURRENT_VERSION = (short) 1;
-
-    static final byte IS_CODE_VALUE = 1;
-    static final byte IS_STRING_VALUE = 2;
-    static final byte IS_NULL_VALUE = 3;
-
     private final DataOutput output;
 
     private final Map<String, Integer> stringCodeMap = new HashMap<>();
@@ -87,8 +80,8 @@ public class NormalizedNodeOutputStreamWriter implements NormalizedNodeStreamWri
 
     private void writeSignatureMarkerAndVersionIfNeeded() throws IOException {
         if(!wroteSignatureMarker) {
-            output.writeByte(SIGNATURE_MARKER);
-            output.writeShort(CURRENT_VERSION);
+            output.writeByte(TokenTypes.SIGNATURE_MARKER);
+            output.writeShort(TokenTypes.LITHIUM_VERSION);
             wroteSignatureMarker = true;
         }
     }
@@ -246,15 +239,15 @@ public class NormalizedNodeOutputStreamWriter implements NormalizedNodeStreamWri
     private void writeCodedString(String key) throws IOException {
         Integer value = stringCodeMap.get(key);
         if(value != null) {
-            output.writeByte(IS_CODE_VALUE);
+            output.writeByte(TokenTypes.IS_CODE_VALUE);
             output.writeInt(value);
         } else {
             if(key != null) {
-                output.writeByte(IS_STRING_VALUE);
+                output.writeByte(TokenTypes.IS_STRING_VALUE);
                 stringCodeMap.put(key, Integer.valueOf(stringCodeMap.size()));
                 output.writeUTF(key);
             } else {
-                output.writeByte(IS_NULL_VALUE);
+                output.writeByte(TokenTypes.IS_NULL_VALUE);
             }
         }
     }