@Override
    public void write(int c) throws IOException {
        int i = -1;
        c &= 0xFFFF; // per API contract
        if (c < 0x80) {
            out.write(c);
            prev = 0;
            return;
        } else if (c < 0xA0) {
            prev = 0;
            // silent loss
            return;
        } else if (c < 0x100) {
            out.write(c);
            prev = 0;
            return;            
        } else if ((i = Arrays.binarySearch(CODE_POINTS, c)) >= 0) {
            out.write(BYTES[i]);
            prev = 0;
            return;                        
        } if ((c & 0xFC00) == 0xDC00) {
            // Got a low surrogate. See if prev was high surrogate
            if (prev != 0) {
                int intVal = (prev << 10) + c + SURROGATE_OFFSET;
                prev = 0;
                this.writeNcr(intVal);
                return;
            } else {
                prev = 0;
                // silent loss
                return;
            }
        } else if ((c & 0xFC00) == 0xD800) {
            // silent loss if prev already was surrogate
            prev = c;
            return;
        } else {
            this.writeNcr(c);
            prev = 0;
            return;
        }
    }
@see java.io.Writer#write(int)
src/nu/validator/io/NcrEscapingWindows1252OutputStreamWriter.java