Mercurial Hosting > luan
comparison src/luan/modules/IoLuan.java @ 1334:c88b486a9511
make some Luan methods static
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 12 Feb 2019 22:53:57 -0700 |
parents | 25746915a241 |
children | e0cf0d108a77 |
comparison
equal
deleted
inserted
replaced
1333:25746915a241 | 1334:c88b486a9511 |
---|---|
44 } | 44 } |
45 | 45 |
46 | 46 |
47 public interface LuanWriter { | 47 public interface LuanWriter { |
48 public Object out(); | 48 public Object out(); |
49 public void write(Luan luan,Object... args) throws LuanException, IOException; | 49 public void write(Object... args) throws LuanException, IOException; |
50 public void close() throws IOException; | 50 public void close() throws IOException; |
51 } | 51 } |
52 | 52 |
53 public static LuanWriter luanWriter(final PrintStream out) { | 53 public static LuanWriter luanWriter(final PrintStream out) { |
54 return new LuanWriter() { | 54 return new LuanWriter() { |
55 | 55 |
56 public Object out() { | 56 public Object out() { |
57 return out; | 57 return out; |
58 } | 58 } |
59 | 59 |
60 public void write(Luan luan,Object... args) throws LuanException { | 60 public void write(Object... args) throws LuanException { |
61 for( Object obj : args ) { | 61 for( Object obj : args ) { |
62 out.print( luan.toString(obj) ); | 62 out.print( Luan.luanToString(obj) ); |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 public void close() { | 66 public void close() { |
67 out.close(); | 67 out.close(); |
74 | 74 |
75 public Object out() { | 75 public Object out() { |
76 return out; | 76 return out; |
77 } | 77 } |
78 | 78 |
79 public void write(Luan luan,Object... args) throws LuanException, IOException { | 79 public void write(Object... args) throws LuanException, IOException { |
80 for( Object obj : args ) { | 80 for( Object obj : args ) { |
81 out.write( luan.toString(obj) ); | 81 out.write( Luan.luanToString(obj) ); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 public void close() throws IOException { | 85 public void close() throws IOException { |
86 out.close(); | 86 out.close(); |
367 | 367 |
368 public Object out() { | 368 public Object out() { |
369 return out; | 369 return out; |
370 } | 370 } |
371 | 371 |
372 public void write(Luan luan,Object... args) throws LuanException, IOException { | 372 public void write(Object... args) throws LuanException, IOException { |
373 for( Object obj : args ) { | 373 for( Object obj : args ) { |
374 out.write( luan.toString(obj) ); | 374 out.write( Luan.luanToString(obj) ); |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 public void close() throws IOException { | 378 public void close() throws IOException { |
379 s = out.toString(); | 379 s = out.toString(); |