private bool ProcessOuter(EmberId id, long idPosition)
{
if (id == EndContainer)
{
if (ReadLength(this.readBuffer) != 0)
{
throw CreateEmberException(
"Unexpected length for End-of-contents identifier at position {0}.", idPosition);
}
if (this.endPositions.Count == 0)
{
throw CreateEmberException(
"Unexpected excess End-of-contents identifier at position {0}.", idPosition);
}
var endPosition = this.endPositions.Pop();
if (endPosition.EndPosition.HasValue)
{
throw CreateEmberException(
"Unexpected End-of-contents identifier at position {0} for definite length at position {1}.",
idPosition,
endPosition.LengthPosition);
}
return IsContainer(endPosition);
}
else
{
this.ReadAndProcessLength(id, false);
return true;
}
}