endOfContent method

dynamic endOfContent(
  1. dynamic reader
)

Implementation

endOfContent( reader ) {

	// footer size: 160bytes + 16-byte alignment padding
	// - 16bytes: magic
	// - padding til 16-byte alignment (at least 1byte?)
	//	(seems like some exporters embed fixed 15 or 16bytes?)
	// - 4bytes: magic
	// - 4bytes: version
	// - 120bytes: zero
	// - 16bytes: magic
	if ( reader.size() % 16 == 0 ) {

		return ( ( reader.getOffset() + 160 + 16 ) & ~ 0xf ) >= reader.size();

	} else {

		return reader.getOffset() + 160 + 16 >= reader.size();

	}

}