1 18 package org.apache.batik.util.io; 19 20 import java.io.IOException ; 21 import java.io.Reader ; 22 23 31 public abstract class NormalizingReader extends Reader { 32 33 41 public int read(char cbuf[], int off, int len) throws IOException { 42 if (len == 0) { 43 return 0; 44 } 45 46 int c = read(); 47 if (c == -1) { 48 return -1; 49 } 50 int result = 0; 51 do { 52 cbuf[result + off] = (char)c; 53 result++; 54 c = read(); 55 } while (c != -1 && result < len); 56 return result; 57 } 58 59 62 public abstract int getLine(); 63 64 67 public abstract int getColumn(); 68 69 } 70 | Popular Tags |