开发者

How i can seperate data got from server that either it is text or image ?i want to implement it in j2me

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';
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜