package com.akjava.lib.common.io;

/**
 * has extension
 * @author aki
 *
 */
public class FileType {
	String type;
	String subtype;
	String extension;
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getSubtype() {
		return subtype;
	}
	public void setSubtype(String subtype) {
		this.subtype = subtype;
	}
	public String getExtension() {
		return extension;
	}
	public FileType(String type, String subtype) {
		this(type,subtype,subtype);
	}
	public FileType(String type, String subtype, String extension) {
		super();
		this.type = type;
		this.subtype = subtype;
		this.extension = extension;
	}
	public void setExtension(String extension) {
		this.extension = extension;
	}
	public static final FileType WEBP=new FileType("image","webp");
	public static final FileType PNG=new FileType("image","png");
	public static final FileType JPEG=new FileType("image","jpeg","jpg");
	public static final FileType GIF=new FileType("image","gif");
	public static final FileType BMP=new FileType("image","bmp");
	
	public String toString(){
		return subtype;//for valuelistbox
	}
}

@@ -30,16 +30,85 @@
 .io;%0D%0A%0D%0A
+import java.util.List;%0D%0A%0D%0Aimport com.google.common.collect.Lists;%0D%0A%0D%0A
 /**%0D%0A * 
@@ -601,24 +601,100 @@
 type);%0D%0A%09%7D%0D%0A
+%09%0D%0A%09public String getMimeType()%7B%0D%0A%09%09return getType()+%22/%22+getSubtype();%0D%0A%09%7D%0D%0A
 %09public File
@@ -1187,24 +1187,24 @@
 e%22,%22gif%22);%0D%0A
-
 %09public stat
@@ -1254,24 +1254,366 @@
 %22bmp%22);%0D%0A%09%0D%0A
+%09public static final List%3CFileType%3E fileTypes=Lists.newArrayList(WEBP,PNG,JPEG,GIF,BMP);%0D%0A%09%0D%0A%09public static FileType getFileTypeByExtension(String extension)%7B%0D%0A%09%09extension=extension.toLowerCase();%0D%0A%09%09for(FileType fileType:fileTypes)%7B%0D%0A%09%09%09if(fileType.getExtension().equals(extension))%7B%0D%0A%09%09%09%09return fileType;%0D%0A%09%09%09%7D%0D%0A%09%09%7D%0D%0A%09%09return null;%0D%0A%09%7D%0D%0A%09%0D%0A
 %09public Stri

update filetype