1 19 20 package gnu.mail.util; 21 22 import java.io.*; 23 24 53 public class QInputStream 54 extends QPInputStream 55 { 56 57 private static final int SPACE = 32; 58 private static final int EQ = 61; 59 private static final int UNDERSCORE = 95; 60 61 65 public QInputStream(InputStream in) 66 { 67 super(in); 68 } 69 70 73 public int read() 74 throws IOException 75 { 76 int c = in.read(); 77 if (c==UNDERSCORE) 78 return SPACE; 79 if (c==EQ) 80 { 81 buf[0] = (byte)in.read(); 82 buf[1] = (byte)in.read(); 83 try 84 { 85 return Integer.parseInt(new String (buf, 0, 2), 16); 86 } 87 catch (NumberFormatException e) 88 { 89 throw new IOException("Quoted-Printable encoding error: "+ 90 e.getMessage()); 91 } 92 } 93 return c; 94 } 95 96 } 97 | Popular Tags |