1 50 51 package org.openlaszlo.iv.flash.util; 52 53 60 public class NativeLineReader implements LineReader { 61 62 private String s; 63 private int cur; 64 65 public NativeLineReader( String s ) { 66 this.s = s; 67 cur = 1; } 69 70 public String readLine() { 71 if( cur >= s.length() ) return null; 72 int end = s.indexOf('\n', cur); 73 if( end == -1 ) { 74 end = s.indexOf('\r', cur); 75 if( end == -1 ) 76 end = s.length(); 77 } 78 String res = s.substring(cur, end); 79 cur = end+1; 80 return res; 81 } 82 83 public void close() {} 84 } 85 | Popular Tags |