private bool ReadCore()
{
try
{
while ((this.readBuffer.Index < this.readBuffer.Count) || this.readBuffer.Read())
{
var outerIdentifierPosition = this.readBuffer.Position;
var outerIdentifier = ReadIdentifier(this.readBuffer);
if (this.ProcessOuter(outerIdentifier, outerIdentifierPosition))
{
if (outerIdentifier == EndContainer)
{
this.innerNumber = Ember.InnerNumber.EndContainer;
return true;
}
if (outerIdentifier.Class == Class.Universal)
{
throw CreateEmberException(
"Unexpected Universal class for outer identifier at position {0}.",
outerIdentifierPosition);
}
this.ReadAndProcessInner();
this.outer = outerIdentifier;
return true;
}
}
}
catch (EndOfStreamException ex)
{
throw CreateEmberException(ex);
}
if (this.endPositions.Count > 0)
{
throw CreateEmberException("Unexpected end of stream at position {0}.", this.readBuffer.Position);
}
return false;
}