forked from json-iterator/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecoder.java
More file actions
46 lines (36 loc) · 1.36 KB
/
Decoder.java
File metadata and controls
46 lines (36 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.jsoniter;
import java.io.IOException;
public interface Decoder {
/**
* Customized decoder to read values from iterator
*
* @param iter the iterator instance
* @return the value to set
* @throws IOException when reading from iterator triggered error
*/
Object decode(JsonIterator iter) throws IOException;
class EmptyDecoder implements Decoder {
@Override
public Object decode(JsonIterator iter) throws IOException {
return null;
}
}
abstract class BooleanDecoder extends EmptyDecoder {
public abstract boolean decodeBoolean(JsonIterator iter) throws IOException;
}
abstract class ShortDecoder extends EmptyDecoder {
public abstract short decodeShort(JsonIterator iter) throws IOException;
}
abstract class IntDecoder extends EmptyDecoder {
public abstract int decodeInt(JsonIterator iter) throws IOException;
}
abstract class LongDecoder extends EmptyDecoder {
public abstract long decodeLong(JsonIterator iter) throws IOException;
}
abstract class FloatDecoder extends EmptyDecoder {
public abstract float decodeFloat(JsonIterator iter) throws IOException;
}
abstract class DoubleDecoder extends EmptyDecoder {
public abstract double decodeDouble(JsonIterator iter) throws IOException;
}
}