public string ReadAtom()
{
string atom;
byte tag = Read1SkipVersion();
switch (tag)
{
case OtpExternal.AtomTag:
int len = Read2BE();
byte[] buffer = new byte[len];
ReadN(buffer);
atom = OtpUtils.Latin1Encoding.GetString(buffer);
if (atom.Length > OtpExternal.MaxAtomLength)
{
/*
* Throwing an exception would be better I think, but truncation
* seems to be the way it has been done in other parts of OTP...
*/
atom = atom.Substring(0, OtpExternal.MaxAtomLength);
}
break;
default:
throw OnBadTag(tag, OtpExternal.AtomTag);
}
return atom;
}