Here you can find the source of getCPCharacter(ByteBuffer buffer)
public static char getCPCharacter(ByteBuffer buffer)
//package com.java2s; //License from project: BEER-WARE LICENSE import java.nio.ByteBuffer; public class Main { private static final char[] CHARACTERS = { '\u20ac', '\0', '\u201a', '\u0192', '\u201e', '\u2026', '\u2020', '\u2021', '\u02c6', '\u2030', '\u0160', '\u2039', '\u0152', '\0', '\u017d', '\0', '\0', '\u2018', '\u2019', '\u201c', '\u201d', '\u2022', '\u2013', '\u2014', '\u02dc', '\u2122', '\u0161', '\u203a', '\u0153', '\0', '\u017e', '\u0178' }; public static char getCPCharacter(ByteBuffer buffer) { int read = buffer.get() & 0xff; if (read == 0) { throw new IllegalArgumentException( "Non cp1252 character 0x" + Integer.toString(read, 16) + " provided"); }//from w ww. j a va 2 s .c om if (read >= 128 && read < 160) { char cpChar = CHARACTERS[read - 128]; if (cpChar == '\0') { cpChar = '?'; } read = cpChar; } return (char) read; } }