title: c++ library for endian-aware reading of raw file stream metadata?
body: <p>I've got raw data streams from image files, like:</p>
  
  <pre><code>vector&lt;char&gt; rawData(fileSize);
  ifstream inFile("image.jpg");
  inFile.read(&amp;rawData[0]);
  </code></pre>
  
  <p>I want to parse the headers of different image formats for height and width. Is there a portable library that can can read ints, longs, shorts, etc. from the buffer/stream, converting for endianess as specified?</p>
  
  <p>I'd like to be able to do something like: <code>short x = rawData.readLeShort(offset);</code> or <code>long y = rawData.readBeLong(offset)</code></p>
  
  <p>An even better option would be a lightweight &amp; portable image metadata library (without the extra weight of an image manipulation library) that can work on raw image data. I've found that Exif libraries out there don't support <code>png</code> and <code>gif</code>.</p>