/*
* 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.
*/
/**
* NOTE: The following four static variables should be used *only* for
* testing whether a encoder can encode a specific character. They
* cannot be used for actual encoding because they are shared across all
* COMPOUND_TEXT encoders and may be stateful.
*/
private static final boolean defaultEncodingSupported;
static {
defaultEncodingSupported = true;
} else {
try {
} catch (IllegalArgumentException e) {
throw new ExceptionInInitializerError
("ISO8859_1 unsupported");
}
}
}
private byte[] byteBuf;
super(cs,
try {
} catch (IllegalArgumentException cannotHappen) {}
}
try {
// The compound text specification only permits the octets
// 0x09, 0x0A, 0x1B, and 0x9B in C0 and C1. Of these, 1B and
// 9B must also be removed because they initiate control
// sequences.
}
//System.out.println("char=" + charBuf[0] + ", enc=" + enc);
== CodingErrorAction.REPORT) {
enc = latin1Encoder;
} else {
}
}
if (nonStandardCharsetBuffer != null) {
} else {
//cr= encoder.flush(des);
}
if (!cr.isUnderflow())
return cr;
byte[] escSequence = CompoundTextSupport.
if (escSequence == null) {
throw new InternalError("Unknown encoding: " +
} else {
return CoderResult.OVERFLOW;
}
continue;
}
if (nonStandardCharsetBuffer == null) {
} else {
}
inOff++;
}
return cr;
} finally {
}
}
//: encoder.flush(out);
reset();
return cr;
}
byte[] escSequence)
{
byteBuf = new byte[(int)c.maxBytesPerChar()];
byte[] encoding = CompoundTextSupport.
throw new InternalError
}
}
if (numNonStandardChars > 0) {
numNonStandardChars = 0;
}
((1 << 14) - 1)) + 1))
{
return CoderResult.OVERFLOW;
}
byte[] nonStandardBytes =
// The non-standard charset header only supports 2^14-1 bytes of data.
// If we have more than that, we have to repeat the header.
do {
} while (nonStandardBytesOff < numBytes);
return CoderResult.UNDERFLOW;
}
/**
* Resets the encoder.
* Call this method to reset the encoder to its initial state
*/
protected void implReset() {
try {
} catch (IllegalArgumentException cannotHappen) {
}
}
/**
* Return whether a character is mappable or not
* @return true if a character is mappable
*/
}
}
}
}
/**
* Try to figure out which CharsetEncoder to use for conversion
* of the specified Unicode character. The target character encoding
* of the returned encoder is approved to be used with Compound Text.
*
* @param ch Unicode character
* @return CharsetEncoder to convert the given character
*/
// 1. Try the current encoder.
return encoder;
}
// 2. Try the default encoder.
try {
} catch (UnsupportedOperationException cannotHappen) {
}
return retval;
}
// 3. Try ISO8859-1.
try {
} catch (UnsupportedOperationException cannotHappen) {}
return retval;
}
// 4. Brute force search of all supported encodings.
{
throw new InternalError("Unsupported encoding: " +
encoding);
}
}
return retval;
}
}
return null;
}
try {
.replaceWith(replacement());
} catch (IllegalArgumentException x) {}
}
}
}