@Override public long getLongValue(int index) { return jsonArray.getLongValue(index); }
@Override public long getLongValue(int index) { return jsonArray.getLongValue(index); }
@Override public long getLongValue(int index) { return jsonArray.getLongValue(index); }
@Override public long getLongValue(int index) { return jsonArray.getLongValue(index); }
private void loadFromJson(InputStream is) throws TunnelException { try { String json = IOUtils.readStreamAsString(is); JSONObject tree = JSONObject.parseObject(json); JSONObject schemaNode = tree.getJSONObject("Schema"); if (schemaNode != null) { schema = new TunnelTableSchema(schemaNode); } else { throw new TunnelException("get table schema fail"); } JSONArray node = tree.getJSONArray("Shards"); if (node != null) { for (int i = 0; i < node.size(); ++i) { long shardId = node.getLongValue(i); shards.add(shardId); } } else { throw new TunnelException("get shard fail"); } } catch (Exception e) { throw new TunnelException("Invalid json content.", e); } }
private void loadFromJson(InputStream is) throws OdpsException { try { String json = IOUtils.readStreamAsString(is); JSONObject tree = JSON.parseObject(json); JSONObject schemaNode = tree.getJSONObject("Schema"); if (schemaNode != null) { schema = new DatahubTableSchema(schemaNode); } else { throw new DatahubException("get table schema fail"); } JSONArray node = tree.getJSONArray("Shards"); if (node != null) { for (int i = 0; i < node.size(); ++i) { long shardId = node.getLongValue(i); shards.add(shardId); } } else { throw new DatahubException("get shard fail"); } } catch (Exception e) { throw new DatahubException("Invalid json content.", e); } }