public byte[] decodeByteArray(String s, String format) { InputStream bin = new ByteArrayInputStream(s.getBytes()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); decode(bin, bout, format); try { bin .close(); bout.close(); } catch (IOException e) {e.printStackTrace();} return bout.toByteArray(); }
public byte[] decodeByteArray(String s, String format) { InputStream bin = new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)); ByteArrayOutputStream bout = new ByteArrayOutputStream(); decode(bin, bout, format); try { bin .close(); bout.close(); } catch (IOException e) {e.printStackTrace();} return bout.toByteArray(); }
public List<N[]> decodeDocument(InputStream in) throws IOException { List<N[]> document = new ArrayList<>(); N[] nodes; for (List<Token> tokens : tokenizer.segmentize(in)) { nodes = toNodeArray(tokens); decode(nodes); document.add(nodes); } in.close(); return document; }
public List<N[]> decodeDocument(InputStream in) throws IOException { List<N[]> document = new ArrayList<>(); N[] nodes; for (List<Token> tokens : tokenizer.segmentize(in)) { nodes = toNodeArray(tokens); decode(nodes); document.add(nodes); } in.close(); return document; }
public void decodeLine(InputStream in, OutputStream out) throws IOException { BufferedReader reader = IOUtils.createBufferedReader(in); PrintStream fout = IOUtils.createBufferedPrintStream(out); N[] nodes; String line; while ((line = reader.readLine()) != null) { nodes = decode(line); fout.println(toString(nodes)+"\n"); } reader.close(); fout.close(); }
public void decodeLine(InputStream in, OutputStream out) throws IOException { BufferedReader reader = IOUtils.createBufferedReader(in); PrintStream fout = IOUtils.createBufferedPrintStream(out); N[] nodes; String line; while ((line = reader.readLine()) != null) { nodes = decode(line); fout.println(toString(nodes)+"\n"); } reader.close(); fout.close(); }
public N[] decode(String sentence) { List<Token> tokens = tokenizer.tokenize(sentence); return decode(toNodeArray(tokens)); }
public N[] decode(String sentence) { List<Token> tokens = tokenizer.tokenize(sentence); return decode(toNodeArray(tokens)); }
public void decodeRaw(InputStream in, OutputStream out) throws IOException { PrintStream fout = IOUtils.createBufferedPrintStream(out); N[] nodes; for (List<Token> tokens : tokenizer.segmentize(in)) { nodes = toNodeArray(tokens); decode(nodes); fout.println(toString(nodes)+"\n"); } in.close(); fout.close(); }
public void decodeRaw(InputStream in, OutputStream out) throws IOException { PrintStream fout = IOUtils.createBufferedPrintStream(out); N[] nodes; for (List<Token> tokens : tokenizer.segmentize(in)) { nodes = toNodeArray(tokens); decode(nodes); fout.println(toString(nodes)+"\n"); } in.close(); fout.close(); }
public void decodeTSV(TSVReader<N> reader, InputStream in, OutputStream out) throws IOException { PrintStream fout = IOUtils.createBufferedPrintStream(out); N[] nodes; reader.open(in); while ((nodes = reader.next()) != null) { decode(nodes); fout.println(toString(nodes)+"\n"); } reader.close(); fout.close(); }
public void decodeTSV(TSVReader<N> reader, InputStream in, OutputStream out) throws IOException { PrintStream fout = IOUtils.createBufferedPrintStream(out); N[] nodes; reader.open(in); while ((nodes = reader.next()) != null) { decode(nodes); fout.println(toString(nodes)+"\n"); } reader.close(); fout.close(); }