/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* 5 types of entry in SJIS_X_0213/Unicode mapping table
*
* (1)Single-Byte
* JIS_X_0213 does not define single-byte character itself, the
* JIS_X_0201 entries are added in for sjis implementation.
*
* (2)Double-Byte SJIS <-> BMP Unicode
* ex: 0x8140 U+3000 # IDEOGRAPHIC SPACE
*
* (3)Double-Byte SJIS <-> Supplementary
* ex: 0xFCF0 U+2A61A # <cjk> [2000] [Unicode3.1]
*
* (4)Double-Byte SJIS <-> Composite
* ex: 0x83F6 U+31F7+309A # [2000]
*
* (5)"Windows-only" special mapping entries
* are handled by MS932_0213.
*/
public SJIS_0213() {
}
}
return new Decoder(this);
}
return new Encoder(this);
}
new PrivilegedAction<CharsetMapping>() {
public CharsetMapping run() {
}
});
}
try {
char c = decodeSingle(b1);
if (c == UNMAPPABLE) {
return CoderResult.UNDERFLOW;
inSize++;
if (c == UNMAPPABLE) {
else
}
outSize++;
}
}
return CoderResult.OVERFLOW;
if (outSize == 2) {
} else {
}
}
return CoderResult.UNDERFLOW;
} finally {
}
}
try {
while (src.hasRemaining()) {
char c = decodeSingle(b1);
if (c == UNMAPPABLE) {
return CoderResult.UNDERFLOW;
inSize++;
if (c == UNMAPPABLE) {
else
}
outSize++;
}
}
return CoderResult.OVERFLOW;
if (outSize == 2) {
} else {
}
}
return CoderResult.UNDERFLOW;
} finally {
}
}
else
}
protected char decodeSingle(int b) {
return mapping.decodeSingle(b);
}
}
return cc;
return cc;
return null;
}
}
}
public boolean canEncode(char c) {
return (encodeChar(c) != UNMAPPABLE);
}
}
}
}
}
// Unlike surrogate pair, the base character of a base+cc composite
// itself is a legal codepoint in 0213, if we simply return UNDERFLOW
// when a base candidate is the last input char in the CharBuffer, like
// what we do for the surrogte pair, encoding will fail if this base
// character is indeed the last character of the input char sequence.
// Keep this base candidate in "leftoverBase" so we can flush it out
// at the end of the encoding circle.
try {
int db;
if (leftoverBase != 0) {
boolean isComp = false;
if (db == UNMAPPABLE)
else
isComp = true;
return CoderResult.OVERFLOW;
leftoverBase = 0;
if (isComp) {
sp++;
continue;
}
}
if (isCompositeBase(c)) {
leftoverBase = c;
} else {
db = encodeChar(c);
return CoderResult.OVERFLOW;
return CoderResult.OVERFLOW;
} else if (Character.isHighSurrogate(c)) {
return CoderResult.UNDERFLOW;
if (db == UNMAPPABLE)
return CoderResult.OVERFLOW;
sp++;
} else if (Character.isLowSurrogate(c)) {
} else {
}
}
sp++;
}
return CoderResult.UNDERFLOW;
} finally {
}
}
try {
while (src.hasRemaining()) {
int db;
if (leftoverBase != 0) {
boolean isComp = false;
if (db == UNMAPPABLE)
else
isComp = true;
return CoderResult.OVERFLOW;
leftoverBase = 0;
if (isComp) {
mark++;
continue;
}
}
if (isCompositeBase(c)) {
leftoverBase = c;
} else {
db = encodeChar(c);
return CoderResult.OVERFLOW;
return CoderResult.OVERFLOW;
} else if (Character.isHighSurrogate(c)) {
return CoderResult.UNDERFLOW;
if (db == UNMAPPABLE)
return CoderResult.OVERFLOW;
mark++;
} else if (Character.isLowSurrogate(c)) {
} else {
}
}
mark++;
}
return CoderResult.UNDERFLOW;
} finally {
}
}
else
}
if (leftoverBase > 0) {
return CoderResult.OVERFLOW;
leftoverBase = 0;
}
return CoderResult.UNDERFLOW;
}
protected void implReset() {
leftoverBase = 0;
}
}
}