comparison src/luan/modules/IoLuan.java @ 1499:22e15cf73040

lucene.backup
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 09 May 2020 23:14:13 -0600
parents f04bfbb08721
children e66e3d50b289
comparison
equal deleted inserted replaced
1498:1b809d2fdf03 1499:22e15cf73040
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 = Utils.readAll(in);
174 in.close();
175 return s; 174 return s;
176 } 175 }
177 176
178 public byte[] read_binary() throws IOException, LuanException { 177 public byte[] read_binary() throws IOException, LuanException {
179 InputStream in = inputStream(); 178 InputStream in = inputStream();
180 byte[] a = Utils.readAll(in); 179 byte[] a = Utils.readAll(in);
181 in.close();
182 return a; 180 return a;
183 } 181 }
184 182
185 public LuanFunction read_lines() throws IOException, LuanException { 183 public LuanFunction read_lines() throws IOException, LuanException {
186 return lines(new BufferedReader(reader())); 184 return lines(new BufferedReader(reader()));
283 LuanIn luanIn = (LuanIn)java; 281 LuanIn luanIn = (LuanIn)java;
284 InputStream in = luanIn.inputStream(); 282 InputStream in = luanIn.inputStream();
285 OutputStream out = outputStream(); 283 OutputStream out = outputStream();
286 IoUtils.copyAll(in,out); 284 IoUtils.copyAll(in,out);
287 out.close(); 285 out.close();
288 in.close();
289 return; 286 return;
290 } 287 }
291 } 288 }
292 throw new LuanException( "bad argument #1 to 'write' (string or binary or Io.uri expected)" ); 289 throw new LuanException( "bad argument #1 to 'write' (string or binary or Io.uri expected)" );
293 } 290 }