Mercurial Hosting > luan
comparison src/luan/modules/IoLuan.java @ 1509:0ba144491a42
lucene.backup zip
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 17 May 2020 14:29:33 -0600 |
parents | 86c5e7000ecf |
children | b89212fd04b5 |
comparison
equal
deleted
inserted
replaced
1508:86c5e7000ecf | 1509:0ba144491a42 |
---|---|
168 return charset==null ? new InputStreamReader(in) : new InputStreamReader(in,charset); | 168 return charset==null ? new InputStreamReader(in) : new InputStreamReader(in,charset); |
169 } | 169 } |
170 | 170 |
171 public String read_text() throws IOException, LuanException { | 171 public String read_text() throws IOException, LuanException { |
172 Reader in = reader(); | 172 Reader in = reader(); |
173 String s = Utils.readAll(in); | 173 String s = IoUtils.readAll(in); |
174 return s; | 174 return s; |
175 } | 175 } |
176 | 176 |
177 public byte[] read_binary() throws IOException, LuanException { | 177 public byte[] read_binary() throws IOException, LuanException { |
178 InputStream in = inputStream(); | 178 InputStream in = inputStream(); |
230 @Override public String to_uri_string() { | 230 @Override public String to_uri_string() { |
231 return "stdin:"; | 231 return "stdin:"; |
232 } | 232 } |
233 | 233 |
234 @Override public String read_text() throws IOException { | 234 @Override public String read_text() throws IOException { |
235 return Utils.readAll(new InputStreamReader(System.in)); | 235 return IoUtils.readAll(new InputStreamReader(System.in)); |
236 } | 236 } |
237 | 237 |
238 @Override public byte[] read_binary() throws IOException { | 238 @Override public byte[] read_binary() throws IOException { |
239 return Utils.readAll(System.in); | 239 return Utils.readAll(System.in); |
240 } | 240 } |
565 @Override public boolean exists() { | 565 @Override public boolean exists() { |
566 return true; | 566 return true; |
567 } | 567 } |
568 | 568 |
569 public void wait_for() | 569 public void wait_for() |
570 throws IOException, LuanException | 570 throws IOException |
571 { | 571 { |
572 try { | 572 IoUtils.waitFor(proc); |
573 proc.waitFor(); | |
574 } catch(InterruptedException e) { | |
575 throw new RuntimeException(e); | |
576 } | |
577 int exitVal = proc.exitValue(); | |
578 if( exitVal != 0 ) { | |
579 Reader err = new InputStreamReader(proc.getErrorStream()); | |
580 String error = "exit value "+exitVal+" in: "+cmd+"\n"+Utils.readAll(err); | |
581 err.close(); | |
582 throw new LuanException(error); | |
583 } | |
584 } | 573 } |
585 | 574 |
586 @Override public String read_text() throws IOException, LuanException { | 575 @Override public String read_text() throws IOException, LuanException { |
587 String s = super.read_text(); | 576 String s = super.read_text(); |
588 wait_for(); | 577 wait_for(); |