/*
* 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.
*/
/**
* @author Limin Shi
*/
public ByteToCharEUC_JP() {
super();
start = 0xA1;
end = 0xFE;
savedSecond = 0;
}
throws MalformedInputException
{
if (savedSecond != 0) {
reset();
throw new MalformedInputException();
}
reset();
return 0;
}
/**
* Resets the converter.
* Call this method to reset the converter to its initial state
*/
public void reset() {
super.reset();
savedSecond = 0;
}
return "EUC_JP";
}
protected char convSingleByte(int b) {
if (b < 0 || b > 0x7F)
return REPLACE_CHAR;
return bcJIS0201.getUnicode(b);
}
if (byte1 == 0x8E) {
}
// Fix for bug 4121358 - similar fix for bug 4117820 put
// into ByteToCharDoubleByte.getUnicode()
return REPLACE_CHAR;
}
}
/**
* Converts sequences of bytes to characters.
* Conversions that result in Exceptions can be restarted by calling
* convert again, with appropriately modified parameters.
* @return the characters written to output.
* @param inStart offset in input array
* @param inEnd offset of last byte to be converted
* @param output character array to receive conversion result
* @param outStart starting offset
* @param outEnd offset of last byte to be written to
* @throw UnsupportedCharacterException for any bytes
* that cannot be converted to the external character set.
*/
throws UnknownCharacterException,
{
char outputChar = REPLACE_CHAR;
// Record beginning offsets
// Loop until we hit the end of the input
if (savedByte == 0) {
inputSize = 1;
} else {
savedByte = 0;
inputSize = 0;
}
// split in the middle of a character
// save the first 2 bytes for next time around
byteOff++;
}
break;
}
if (savedSecond != 0) {
savedSecond = 0;
} else {
inputSize++;
}
inputSize++;
} else { // JIS0208
// split in the middle of a character
// save the first byte for next time around
break;
}
byte1 &= 0xff;
inputSize++;
}
}
if (outputChar == REPLACE_CHAR) {
if (subMode)
else {
throw new UnknownCharacterException();
}
}
throw new ConversionBufferFullException();
}
}
}