1 package gnu.mapping; 2 import gnu.text.NullReader; 3 4 7 8 public class CharArrayInPort extends InPort 9 { 10 public CharArrayInPort (char[] buffer, int len) 11 { 12 super(NullReader.nullReader, "<string>"); 13 try 14 { 15 setBuffer(buffer); 16 } 17 catch (java.io.IOException ex) 18 { 19 throw new Error (ex.toString()); } 21 limit = len; 22 } 23 24 public CharArrayInPort (char[] buffer) 25 { 26 this(buffer, buffer.length); 27 } 28 29 public CharArrayInPort (String string) 30 { 31 this(string.toCharArray()); 32 } 33 34 public int read () throws java.io.IOException 35 { 36 if (pos >= limit) 37 return -1; 38 return super.read(); 39 } 40 } 41 | Popular Tags |