try {
if (stream instanceof FormatIdInputStream) {
readExternal((FormatIdInputStream) stream);
} else {
readExternal(new FormatIdInputStream(stream));
}
stream = null;
// at this point the value is only in the char[]
// so call again to convert to a String