ï»??xml version="1.0" encoding="utf-8" standalone="yes"?>成人久久久精品乱码一区二区三区,色在线视频网,在线观看亚洲精品http://www.aygfsteel.com/gen-sky/category/36135.html我们现在不是应该讨论该不该挽留,˜q˜æ˜¯å› äØ“(f¨´)讨论如何疏导我们的互联网如何发展。互联网˜q™ç§å¼ºå¤§çš„æ­¦å™¨ï¼Œ˜q˜æ²¡æœ‰æŽŒæ¡åœ¨æˆ‘们手中åQŒæ‰€ä»¥éœ€è¦ç´§å¿«æŽŒæ¡ã€?/description>zh-cnFri, 19 Mar 2010 10:43:38 GMTFri, 19 Mar 2010 10:43:38 GMT60Java判断囄¡‰‡æ–‡äšg的类åž? http://www.aygfsteel.com/gen-sky/archive/2010/03/17/315675.html星期äº?/dc:creator>星期äº?/author>Wed, 17 Mar 2010 07:04:00 GMThttp://www.aygfsteel.com/gen-sky/archive/2010/03/17/315675.htmlhttp://www.aygfsteel.com/gen-sky/comments/315675.htmlhttp://www.aygfsteel.com/gen-sky/archive/2010/03/17/315675.html#Feedback0http://www.aygfsteel.com/gen-sky/comments/commentRss/315675.htmlhttp://www.aygfsteel.com/gen-sky/services/trackbacks/315675.html     判断文äšg的类型,而不是判断文件的后缀å?br />


import java.io.*;
import javax.imageio.*;
import java.util.*;
import javax.imageio.stream.*;

public class Test {
    
public static void main(String[] args) {
        File f 
= new File("c://test//3.jpg");
        
if (f.exists()) {
            System.out.println(getFormatInFile(f));
        }
    }

    
// Returns the format of the image in the file 'f'.
    
// Returns null if the format is not known.
    public static String getFormatInFile(File f) {
        
return getFormatName(f);
    }

    
// Returns the format name of the image in the object 'o'.
    
// Returns null if the format is not known.
    private static String getFormatName(Object o) {
        
try {
            
// Create an image input stream on the image
            ImageInputStream iis = ImageIO.createImageInputStream(o);

            
// Find all image readers that recognize the image format
            Iterator iter = ImageIO.getImageReaders(iis);
            
if (!iter.hasNext()) {
                
// No readers found
                return null;
            }

            
// Use the first reader
            ImageReader reader = (ImageReader) iter.next();

            
// Close stream
            iis.close();

            
// Return the format name
            return reader.getFormatName();
        } 
catch (IOException e) {
            
//
        }

        
// The image could not be read
        return null;
    }
}




]]>
Ö÷Õ¾Ö©Öë³ØÄ£°å£º µç°×ÏØ| É«´ïÏØ| ÓåÖÐÇø| ²ýÒØÊÐ| ƽÁ¹ÊÐ| ãòË®ÏØ| ÍòÔØÏØ| ʯºÓ×ÓÊÐ| ÃñºÍ| ÀíÌÁÏØ| ÎäÉ½ÏØ| ÕòêãÏØ| ÄþÑôÏØ| ÈðÀöÊÐ| ¸§Ë³ÊÐ| ¶÷Ê©ÊÐ| ÒËÕÂÏØ| Èô¶û¸ÇÏØ| ËÕÄáÌØÓÒÆì| ²¼¶û½òÏØ| ÐÞÎÄÏØ| Â¹ÒØÏØ| ¹àÄÏÏØ| ͼƬ| ººÖÐÊÐ| ÆÕ¸ñÏØ| ¹óϪÊÐ| µü²¿ÏØ| ѰÎÚÏØ| ºÍÌïÏØ| ÷ëÓÎÏØ| »³¼¯ÏØ| ºÏÑôÏØ| Í©ÏçÊÐ| ¿ª½­ÏØ| ºÓ±±Çø| ÎýÁÖ¹ùÀÕÃË| ±±º£ÊÐ| ÓÀ¼ÎÏØ| ÈýÃ÷ÊÐ| ÎIJýÊÐ|