BufferedReader br = new BufferedReader(new InputStreamReader(in)); String line; while ((line = br.readLine()) != null && !line.equals("")) { addHeaderLine(line);
StringBuffer buffer = new StringBuffer(); boolean cr = false; boolean lf = false; boolean flush = true; String line = null; while (true) { int c = in.read(); boolean start = buffer.length() == 0; boolean white = c == '\t' || c == ' '; if (start) { if (line != null) { if (white) {  while (c == '\t' || c == ' ') c = in.read(); buffer.append(line); buffer.append(' ');  } else { addHeaderLine(line); line = null; } } } if (c == '\r') { cr = true; } else if (c == '\n') { lf = true; } else { buffer.append((char) c);    if (cr || lf) { cr = lf = true; } } if (cr && lf) { line = buffer.toString().trim(); if (line.length() == 0) { break; } buffer = new StringBuffer(); cr = lf = false; }
    public void load(InputStream in) throws MessagingException {        // try and figure out what format it's in?        try {            BufferedReader br = new BufferedReader(new InputStreamReader(in));            String line;            while ((line = br.readLine()) != null && !line.equals("")) {                addHeaderLine(line);            }        } catch (IOException e) {            throw new MessagingException(e.getMessage());        }    }