public JsonImport(File jsonFile, String worksheetName, Workspace workspace,String encoding, int maxNumLines, JSONArray tree,boolean isJSONLines) throws FileNotFoundException, Exception { super(worksheetName, workspace, encoding); FileObject fo = new FileObject(jsonFile, encoding); if(isJSONLines){ this.json = JSONUtil.convertJSONLinesToJSONArray(new FileInputStream(fo.file), fo.encoding); } else{ this.json = fo; } this.workspace = workspace; this.maxNumLines = maxNumLines; this.columnsJson = tree; this.worksheetName = worksheetName; this.encoding = encoding; }
private Worksheet generateWorksheetFromJLStream(String sourceName, InputStream is, InputProperties inputTypeParams, Workspace workspace) throws Exception{ Worksheet worksheet; String encoding = (String)inputTypeParams.get(InputProperty.ENCODING); int maxNumLines = (inputTypeParams.get(InputProperty.MAX_NUM_LINES) != null)? (int)inputTypeParams.get(InputProperty.MAX_NUM_LINES) : -1; Object json=JSONUtil.convertJSONLinesToJSONArray(is,encoding); JsonImport imp = new JsonImport(json, sourceName, workspace, encoding, maxNumLines); worksheet = imp.generateWorksheet(); return worksheet; } }