コード例 #1
0
 @Override
 boolean isFileFormat(LEDataInputStream stream) {
   try {
     byte[] signature = new byte[3];
     stream.read(signature);
     stream.unread(signature);
     return signature[0] == 'G' && signature[1] == 'I' && signature[2] == 'F';
   } catch (Exception e) {
     return false;
   }
 }
コード例 #2
0
 @Override
 boolean isFileFormat(LEDataInputStream stream) {
   try {
     byte[] header = new byte[18];
     stream.read(header);
     stream.unread(header);
     int infoHeaderSize =
         (header[14] & 0xFF)
             | ((header[15] & 0xFF) << 8)
             | ((header[16] & 0xFF) << 16)
             | ((header[17] & 0xFF) << 24);
     return header[0] == 0x42 && header[1] == 0x4D && infoHeaderSize >= BMPHeaderFixedSize;
   } catch (Exception e) {
     return false;
   }
 }