io.ipfs.api.JSONParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-xpx-ipfs-api Show documentation
Show all versions of java-xpx-ipfs-api Show documentation
The ProximaX IPFS Java API is a Java library for interacting IPFS server.
The newest version!
package io.ipfs.api;
import java.util.*;
import java.lang.reflect.*;
public class JSONParser
{
private static char skipSpaces(String json, int[] pos)
{
while (true)
{
if (pos[0] >= json.length())
return 0;
char ch = json.charAt(pos[0]);
if (Character.isWhitespace(ch))
pos[0]++;
else
return ch;
}
}
private static Boolean parseBoolean(String json, int[] pos)
{
if (json.regionMatches(pos[0], "true", 0, 4))
{
pos[0] += 4;
return Boolean.TRUE;
}
if (json.regionMatches(pos[0], "false", 0, 5))
{
pos[0] += 5;
return Boolean.FALSE;
}
return null;
}
private static Number parseNumber(String json, int[] pos)
{
int endPos = json.length();
int startPos = pos[0];
boolean foundExp = false;
boolean foundDot = false;
boolean allowPM = true;
for (int i=startPos; i parseStream(String json)
{
if (json == null)
return null;
int[] pos = new int[1];
List