/*
* 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
*/
/*
* 1st level index, provided by subclass
*/
protected short index1[];
/*
* 2nd level index, provided by subclass
*/
protected char highHalfZoneCode;
public short[] getIndex1() {
return index1;
}
return index2;
}
{
if (highHalfZoneCode != 0) {
highHalfZoneCode = 0;
badInputLength = 0;
throw new MalformedInputException();
}
return 0;
}
/**
* Converts characters to sequences of bytes.
* Conversions that result in Exceptions can be restarted by calling
* convert again, with appropriately modified parameters.
* @return the characters written to output.
* @param input char array containing text in Unicode
* @param inStart offset in input array
* @param inEnd offset of last byte to be converted
* @param output byte array to receive conversion result
* @param outStart starting offset
* @param outEnd offset of last byte to be written to
* @throw UnsupportedCharacterException for any character
* that cannot be converted to the external character set.
*/
{
char inputChar; // Input character to be converted
byte[] outputByte; // Output byte written to output
byte[] tmpbuf = new byte[2];
// Record beginning offsets
if (highHalfZoneCode != 0) {
highHalfZoneCode = 0;
// This is legal UTF16 sequence.
badInputLength = 1;
throw new UnknownCharacterException();
} else {
// This is illegal UTF16 sequence.
badInputLength = 0;
throw new MalformedInputException();
}
}
// Loop until we hit the end of the input
inputSize = 1;
outputByte = tmpbuf;
// Is this a high surrogate?
// Is this the last character of the input?
break;
}
// Is there a low surrogate following?
// We have a valid surrogate pair. Too bad we don't do
// surrogates. Is substitution enabled?
if (subMode) {
inputSize = 2;
} else {
badInputLength = 2;
throw new UnknownCharacterException();
}
} else {
// We have a malformed surrogate pair
badInputLength = 1;
throw new MalformedInputException();
}
}
// Is this an unaccompanied low surrogate?
badInputLength = 1;
throw new MalformedInputException();
} else {
if (ncode != 0 ) {
outputSize = 2;
} else {
if (subMode) {
} else {
badInputLength = 1;
throw new UnknownCharacterException();
}
}
}
}
// If we don't have room for the output, throw an exception
throw new ConversionBufferFullException();
// Put the byte in the output buffer
for (int i = 0; i < outputSize; i++) {
}
}
// Return the length written to the output buffer
}
/**
* the maximum number of bytes needed to hold a converted char
* @returns the maximum number of bytes needed for a converted char
*/
public int getMaxBytesPerChar() {
return 2;
}
/**
* Resets the converter.
* Call this method to reset the converter to its initial state
*/
public void reset() {
highHalfZoneCode = 0;
}
/**
* Return whether a character is mappable or not
* @return true if a character is mappable
*/
byte[] outByte = new byte[2];
return true;
return true;
return false;
}
/*
* Can be changed by subclass
*/
if (inputChar < 0x80) {
return 1;
}
return 0;
}
/*
* Can be changed by subclass
*/
}
}