// Get list of unique supported read formats
String[] formatNames = ImageIO.getReaderFormatNames();
formatNames = unique(formatNames);
// e.g. png jpeg gif jpg
// Get list of unique supported write formats
formatNames = ImageIO.getWriterFormatNames();
formatNames = unique(formatNames);
// e.g. png jpeg jpg
// Get list of unique MIME types that can be read
formatNames = ImageIO.getReaderMIMETypes();
formatNames = unique(formatNames);
// e.g image/jpeg image/png image/x-png image/gif
// Get list of unique MIME types that can be written
formatNames = ImageIO.getWriterMIMETypes();
formatNames = unique(formatNames);
// e.g. image/jpeg image/png image/x-png
// Converts all strings in 'strings' to lowercase
// and returns an array containing the unique values.
// All returned values are lowercase.
public static String[] unique(String[] strings) {
Set set = new HashSet();
for (int i=0; i
set.add(name);
}
return (String[])set.toArray(new String[0]);
}
source:java-tips.org
No comments:
Post a Comment