class ChunkyPNG::Datastream

def verify_signature!(io)

Raises:
  • (RuntimeError) - An exception is raised if the PNG signature is not found at

Parameters:
  • io (IO) -- The stream to read the PNG signature from.
def verify_signature!(io)
  signature = io.read(ChunkyPNG::Datastream::SIGNATURE.length)
  unless ChunkyPNG.force_binary(signature) == ChunkyPNG::Datastream::SIGNATURE
    raise ChunkyPNG::SignatureMismatch, "PNG signature not found, found #{signature.inspect} instead of #{ChunkyPNG::Datastream::SIGNATURE.inspect}!"
  end
end