()
| 212 | |
| 213 | //#if FILE_IO |
| 214 | public String getPhotoMIMEType() { |
| 215 | if (photo.length==1) return null; |
| 216 | try { |
| 217 | if (photo[0]==(byte)0xff && |
| 218 | photo[1]==(byte)0xd8 && |
| 219 | ((photo[6]==(byte)'J' && |
| 220 | photo[7]==(byte)'F' && |
| 221 | photo[8]==(byte)'I' && |
| 222 | photo[9]==(byte)'F') |
| 223 | || |
| 224 | (photo[6]==(byte)'E' && |
| 225 | photo[7]==(byte)'x' && |
| 226 | photo[8]==(byte)'i' && |
| 227 | photo[9]==(byte)'f') |
| 228 | ) |
| 229 | ) |
| 230 | return "image/jpeg"; |
| 231 | |
| 232 | if (photo[0]==(byte)0x89 && |
| 233 | photo[1]==(byte)'P' && |
| 234 | photo[2]==(byte)'N' && |
| 235 | photo[3]==(byte)'G') |
| 236 | return "image/png"; |
| 237 | |
| 238 | if (photo[0]==(byte)'G' && |
| 239 | photo[1]==(byte)'I' && |
| 240 | photo[2]==(byte)'F') |
| 241 | return "image/gif"; |
| 242 | |
| 243 | if (photo[0]==(byte)'B' && |
| 244 | photo[1]==(byte)'M') |
| 245 | return "image/x-ms-bmp"; |
| 246 | } catch (Exception e) {} |
| 247 | //System.out.println("unknown MIME type"); |
| 248 | return null; |
| 249 | } |
| 250 | |
| 251 | public String getFileType() { |
| 252 | String MIMEtype=getPhotoMIMEType(); |
no outgoing calls
no test coverage detected