private int decodeNonspaceChar(int ch) throws IOException { if (ch != '=') { return ch; } // we need to get two characters after the quotation marker byte[] b = new byte[2]; if (in.read(b) < 2) { throw new IOException("Truncated quoted printable data"); } if (b[0] == '\r') { // we've found an encoded carriage return. The next char needs to be a newline if (b[1] != '\n') { throw new IOException("Invalid quoted printable encoding"); } // this was a soft linebreak inserted by the encoding. We just toss this away // on decode. We need to return something, so recurse and decode the next. return read(); } // this is a hex pair we need to convert back to a single byte. b[0] = DECODING_TABLE[b[0]]; b[1] = DECODING_TABLE[b[1]]; return (b[0] << 4) | b[1]; }
private int decodeNonspaceChar(int ch) throws IOException { if (ch != '=') { return ch; } // we need to get two characters after the quotation marker byte[] b = new byte[2]; if (in.read(b) < 2) { throw new IOException("Truncated quoted printable data"); } if (b[0] == '\r') { // we've found an encoded carriage return. The next char needs to be a newline if (b[1] != '\n') { throw new IOException("Invalid quoted printable encoding"); } // this was a soft linebreak inserted by the encoding. We just toss this away // on decode. We need to return something, so recurse and decode the next. return read(); } // this is a hex pair we need to convert back to a single byte. b[0] = DECODING_TABLE[b[0]]; b[1] = DECODING_TABLE[b[1]]; return (b[0] << 4) | b[1]; }
private int decodeNonspaceChar(int ch) throws IOException { if (ch != '=') { return ch; } // we need to get two characters after the quotation marker byte[] b = new byte[2]; if (in.read(b) < 2) { throw new IOException("Truncated quoted printable data"); } if (b[0] == '\r') { // we've found an encoded carriage return. The next char needs to be a newline if (b[1] != '\n') { throw new IOException("Invalid quoted printable encoding"); } // this was a soft linebreak inserted by the encoding. We just toss this away // on decode. We need to return something, so recurse and decode the next. return read(); } // this is a hex pair we need to convert back to a single byte. b[0] = DECODING_TABLE[b[0]]; b[1] = DECODING_TABLE[b[1]]; return (b[0] << 4) | b[1]; }
private int decodeNonspaceChar(int ch) throws IOException { if (ch != '=') { return ch; } // we need to get two characters after the quotation marker byte[] b = new byte[2]; if (in.read(b) < 2) { throw new IOException("Truncated quoted printable data"); } if (b[0] == '\r') { // we've found an encoded carriage return. The next char needs to be a newline if (b[1] != '\n') { throw new IOException("Invalid quoted printable encoding"); } // this was a soft linebreak inserted by the encoding. We just toss this away // on decode. We need to return something, so recurse and decode the next. return read(); } // this is a hex pair we need to convert back to a single byte. b[0] = DECODING_TABLE[b[0]]; b[1] = DECODING_TABLE[b[1]]; return (b[0] << 4) | b[1]; }