Methods Summary |
---|
public boolean | isError()Returns true if this result represents a malformed-input error or an
unmappable-character error.
return this.type == TYPE_MALFORMED_INPUT
|| this.type == TYPE_UNMAPPABLE_CHAR;
|
public boolean | isMalformed()Returns true if this result represents a malformed-input error.
return this.type == TYPE_MALFORMED_INPUT;
|
public boolean | isOverflow()Returns true if this result is an overflow condition.
return this.type == TYPE_OVERFLOW;
|
public boolean | isUnderflow()Returns true if this result is an underflow condition.
return this.type == TYPE_UNDERFLOW;
|
public boolean | isUnmappable()Returns true if this result represents an unmappable-character error.
return this.type == TYPE_UNMAPPABLE_CHAR;
|
public int | length()Gets the length of the erroneous input. The length is only meaningful to
a malformed-input error or an unmappble character error.
if (this.type == TYPE_MALFORMED_INPUT
|| this.type == TYPE_UNMAPPABLE_CHAR) {
return this.length;
}
// niochar.09=The length of the erroneous input is only meaningful to
// a malformed-input error or an unmappble character error
throw new UnsupportedOperationException(Messages
.getString("niochar.09")); //$NON-NLS-1$
|
public static synchronized java.nio.charset.CoderResult | malformedForLength(int length)Gets a CoderResult object indicating a malformed-input
error.
if (length > 0) {
Integer key = Integer.valueOf(length);
synchronized (_malformedErrors) {
CoderResult r = _malformedErrors.get(key);
if (null == r) {
r = new CoderResult(TYPE_MALFORMED_INPUT, length);
_malformedErrors.put(key, r);
}
return r;
}
}
// niochar.08=The length must be positive: {0}.
throw new IllegalArgumentException(Messages.getString(
"niochar.08", length)); //$NON-NLS-1$
|
public void | throwException()Throws an exception corresponding to this coder result.
switch (this.type) {
case TYPE_UNDERFLOW:
throw new BufferUnderflowException();
case TYPE_OVERFLOW:
throw new BufferOverflowException();
case TYPE_UNMAPPABLE_CHAR:
throw new UnmappableCharacterException(this.length);
case TYPE_MALFORMED_INPUT:
throw new MalformedInputException(this.length);
default:
throw new CharacterCodingException();
}
|
public java.lang.String | toString()Returns a text description of this result.
String dsc = null;
switch (this.type) {
case TYPE_UNDERFLOW:
dsc = "UNDERFLOW error"; //$NON-NLS-1$
break;
case TYPE_OVERFLOW:
dsc = "OVERFLOW error"; //$NON-NLS-1$
break;
case TYPE_UNMAPPABLE_CHAR:
dsc = "Unmappable-character error with erroneous input length " //$NON-NLS-1$
+ this.length;
break;
case TYPE_MALFORMED_INPUT:
dsc = "Malformed-input error with erroneous input length " //$NON-NLS-1$
+ this.length;
break;
default:
dsc = ""; //$NON-NLS-1$
break;
}
return "CoderResult[" + dsc + "]"; //$NON-NLS-1$ //$NON-NLS-2$
|
public static synchronized java.nio.charset.CoderResult | unmappableForLength(int length)Gets a CoderResult object indicating an unmappable
character error.
if (length > 0) {
Integer key = Integer.valueOf(length);
synchronized (_unmappableErrors) {
CoderResult r = _unmappableErrors.get(key);
if (null == r) {
r = new CoderResult(TYPE_UNMAPPABLE_CHAR, length);
_unmappableErrors.put(key, r);
}
return r;
}
}
// niochar.08=The length must be positive: {0}.
throw new IllegalArgumentException(Messages.getString(
"niochar.08", length)); //$NON-NLS-1$
|