@@ -32,10 +32,8 @@ public class Decoder {
3232 class Result {
3333 private final JsonNode obj ;
3434 private long offset ;
35- private final Type type ;
3635
37- Result (JsonNode obj , Type t , long offset ) {
38- this .type = t ;
36+ Result (JsonNode obj , long offset ) {
3937 this .obj = obj ;
4038 this .offset = offset ;
4139
@@ -159,28 +157,28 @@ public Result decode(long offset) throws MaxMindDbException, IOException {
159157 switch (type ) {
160158 case UTF8_STRING :
161159 TextNode s = new TextNode (Decoder .decodeString (bytes ));
162- return new Result (s , type , new_offset );
160+ return new Result (s , new_offset );
163161 case DOUBLE :
164162 DoubleNode d = Decoder .decodeDouble (bytes );
165- return new Result (d , type , new_offset );
163+ return new Result (d , new_offset );
166164 case BYTES :
167165 BinaryNode b = new BinaryNode (Decoder .decodeBytes (bytes ));
168- return new Result (b , type , new_offset );
166+ return new Result (b , new_offset );
169167 case UINT16 :
170168 IntNode i = Decoder .decodeUint16 (bytes );
171- return new Result (i , type , new_offset );
169+ return new Result (i , new_offset );
172170 case UINT32 :
173171 LongNode l = Decoder .decodeUint32 (bytes );
174- return new Result (l , type , new_offset );
172+ return new Result (l , new_offset );
175173 case INT32 :
176174 IntNode int32 = Decoder .decodeInt32 (bytes );
177- return new Result (int32 , type , new_offset );
175+ return new Result (int32 , new_offset );
178176 case UINT64 :
179177 BigIntegerNode bi = Decoder .decodeUint64 (bytes );
180- return new Result (bi , type , new_offset );
178+ return new Result (bi , new_offset );
181179 case UINT128 :
182180 BigIntegerNode uint128 = Decoder .decodeUint128 (bytes );
183- return new Result (uint128 , type , new_offset );
181+ return new Result (uint128 , new_offset );
184182 default :
185183 throw new MaxMindDbException ("Unknown or unexpected type: "
186184 + type .name ());
@@ -207,8 +205,7 @@ private Result decodePointer(int ctrlByte, long offset) throws IOException {
207205 Log .debug ("Buffer" , buffer );
208206 }
209207
210- buffer .put (0 , pointerSize == 4 ? (byte ) 0
211- : (byte ) (ctrlByte & 0x7 ));
208+ buffer .put (0 , pointerSize == 4 ? (byte ) 0 : (byte ) (ctrlByte & 0x7 ));
212209
213210 long packed = Util .decodeLong (buffer .array ());
214211
@@ -226,8 +223,7 @@ private Result decodePointer(int ctrlByte, long offset) throws IOException {
226223 Log .debug ("Pointer to" , String .valueOf (pointer ));
227224 }
228225
229- return new Result (new LongNode (pointer ), Type .POINTER , offset
230- + pointerSize );
226+ return new Result (new LongNode (pointer ), offset + pointerSize );
231227 }
232228
233229 private static String decodeString (byte [] bytes ) {
@@ -260,14 +256,14 @@ static BigIntegerNode decodeUint128(byte[] bytes) {
260256 }
261257
262258 private static DoubleNode decodeDouble (byte [] bytes ) {
263- return new DoubleNode (Double .parseDouble (new String (bytes ,
264- Charset .forName ("US-ASCII" ))));
259+ return new DoubleNode (Double .parseDouble (new String (bytes , Charset
260+ .forName ("US-ASCII" ))));
265261 }
266262
267263 private Result decodeBoolean (long size , long offset ) {
268264 BooleanNode b = size == 0 ? BooleanNode .FALSE : BooleanNode .TRUE ;
269265
270- return new Result (b , Type . BOOLEAN , offset );
266+ return new Result (b , offset );
271267 }
272268
273269 private Result decodeArray (long size , long offset )
@@ -292,7 +288,7 @@ private Result decodeArray(long size, long offset)
292288 Log .debug ("Decoded array" , array .toString ());
293289 }
294290
295- return new Result (array , Type . ARRAY , offset );
291+ return new Result (array , offset );
296292 }
297293
298294 private Result decodeMap (long size , long offset ) throws MaxMindDbException ,
@@ -323,7 +319,7 @@ private Result decodeMap(long size, long offset) throws MaxMindDbException,
323319 Log .debug ("Decoded map" , map .toString ());
324320 }
325321
326- return new Result (map , Type . MAP , offset );
322+ return new Result (map , offset );
327323
328324 }
329325
0 commit comments