comparison core/src/luan/modules/IoLuan.java @ 202:75750ceb45ee

add LuanState.registry git-svn-id: https://luan-java.googlecode.com/svn/trunk@203 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 04 Jul 2014 17:18:39 +0000
parents 3dcb0f9bee82
children 99eef1d0e706
comparison
equal deleted inserted replaced
201:27abb3746917 202:75750ceb45ee
3 import java.io.InputStream; 3 import java.io.InputStream;
4 import java.io.OutputStream; 4 import java.io.OutputStream;
5 import java.io.PrintStream; 5 import java.io.PrintStream;
6 import java.io.Reader; 6 import java.io.Reader;
7 import java.io.Writer; 7 import java.io.Writer;
8 import java.io.FileReader;
9 import java.io.FileWriter;
10 import java.io.BufferedReader; 8 import java.io.BufferedReader;
11 import java.io.BufferedWriter; 9 import java.io.BufferedWriter;
12 import java.io.BufferedInputStream; 10 import java.io.BufferedInputStream;
13 import java.io.BufferedOutputStream; 11 import java.io.BufferedOutputStream;
14 import java.io.File; 12 import java.io.File;
311 } 309 }
312 310
313 public static final class LuanUrl extends LuanIn { 311 public static final class LuanUrl extends LuanIn {
314 private final URL url; 312 private final URL url;
315 313
316 public LuanUrl(String s) throws MalformedURLException { 314 private LuanUrl(String s) throws MalformedURLException {
317 this.url = new URL(s); 315 this.url = new URL(s);
318 } 316 }
319 317
320 @Override InputStream inputStream() throws IOException { 318 @Override InputStream inputStream() throws IOException {
321 return url.openStream(); 319 return url.openStream();
327 } 325 }
328 326
329 public static final class LuanFile extends LuanIO { 327 public static final class LuanFile extends LuanIO {
330 private final File file; 328 private final File file;
331 329
332 public LuanFile(String name) { 330 private LuanFile(String name) {
333 this(new File(name)); 331 this(new File(name));
334 } 332 }
335 333
336 public LuanFile(File file) { 334 private LuanFile(File file) {
337 this.file = file; 335 this.file = file;
338 } 336 }
339 337
340 @Override InputStream inputStream() throws IOException { 338 @Override InputStream inputStream() throws IOException {
341 return new FileInputStream(file); 339 return new FileInputStream(file);
427 } 425 }
428 426
429 public static final class LuanSocket extends LuanIO { 427 public static final class LuanSocket extends LuanIO {
430 private final Socket socket; 428 private final Socket socket;
431 429
432 public LuanSocket(String host,int port) throws IOException { 430 private LuanSocket(String host,int port) throws IOException {
433 this(new Socket(host,port)); 431 this(new Socket(host,port));
434 } 432 }
435 433
436 public LuanSocket(Socket socket) throws IOException { 434 private LuanSocket(Socket socket) throws IOException {
437 this.socket = socket; 435 this.socket = socket;
438 } 436 }
439 437
440 @Override InputStream inputStream() throws IOException { 438 @Override InputStream inputStream() throws IOException {
441 return socket.getInputStream(); 439 return socket.getInputStream();