|
| 1 | +package decoder; |
| 2 | +public class int_array implements com.jsoniter.spi.Decoder { |
| 3 | +public static java.lang.Object decode_(com.jsoniter.JsonIterator iter) throws java.io.IOException { com.jsoniter.CodegenAccess.resetExistingObject(iter); |
| 4 | +if (iter.readNull()) { return null; } |
| 5 | +if (!com.jsoniter.CodegenAccess.readArrayStart(iter)) { |
| 6 | +return new int[0]; |
| 7 | +} |
| 8 | +int a1 = iter.readInt(); |
| 9 | +if (com.jsoniter.CodegenAccess.nextToken(iter) != ',') { |
| 10 | +return new int[]{ a1 }; |
| 11 | +} |
| 12 | +int a2 = iter.readInt(); |
| 13 | +if (com.jsoniter.CodegenAccess.nextToken(iter) != ',') { |
| 14 | +return new int[]{ a1, a2 }; |
| 15 | +} |
| 16 | +int a3 = iter.readInt(); |
| 17 | +if (com.jsoniter.CodegenAccess.nextToken(iter) != ',') { |
| 18 | +return new int[]{ a1, a2, a3 }; |
| 19 | +} |
| 20 | +int a4 = (int) iter.readInt(); |
| 21 | +int[] arr = new int[8]; |
| 22 | +arr[0] = a1; |
| 23 | +arr[1] = a2; |
| 24 | +arr[2] = a3; |
| 25 | +arr[3] = a4; |
| 26 | +int i = 4; |
| 27 | +while (com.jsoniter.CodegenAccess.nextToken(iter) == ',') { |
| 28 | +if (i == arr.length) { |
| 29 | +int[] newArr = new int[arr.length * 2]; |
| 30 | +System.arraycopy(arr, 0, newArr, 0, arr.length); |
| 31 | +arr = newArr; |
| 32 | +} |
| 33 | +arr[i++] = iter.readInt(); |
| 34 | +} |
| 35 | +int[] result = new int[i]; |
| 36 | +System.arraycopy(arr, 0, result, 0, i); |
| 37 | +return result; |
| 38 | +}public java.lang.Object decode(com.jsoniter.JsonIterator iter) throws java.io.IOException { |
| 39 | +return decode_(iter); |
| 40 | +} |
| 41 | +} |
0 commit comments