How i can seperate data got from server that either it is text or image ?i want to implement it in j2开发者_开发技巧me.
If You retrieve the data form a stream
Example for GIF
public static boolean isGif(InputStream stream) {
byte[] signature = new byte[3];
stream.read(signature);
stream.unread(signature);
return signature[0] == 'G' && signature[1] == 'I' && signature[2] == 'F';
}
精彩评论