返回顶部

收藏

【Java】使用 Activation 框架

更多

MailcapCommandMapDemo1.java

import javax.activation.CommandInfo;
import javax.activation.MailcapCommandMap;

public class MailcapCommandMapDemo1 {
  public static void main(String[] args) {
    MailcapCommandMap mailcapCommandMap = new MailcapCommandMap();

    String[] mimeTypes = mailcapCommandMap.getMimeTypes();
    for (String mimeType : mimeTypes) {
      System.out.println(mimeType);
      CommandInfo[] commandInfos = mailcapCommandMap.getAllCommands(mimeType);
      for (CommandInfo info : commandInfos) {
        System.out.println(" " + info.getCommandName() + " : "
            + info.getCommandClass());
      }
    }
  }
}
/*
image/jpeg
 view : com.sun.activation.viewers.ImageViewer
image/gif
 view : com.sun.activation.viewers.ImageViewer
text/*
 view : com.sun.activation.viewers.TextViewer
 edit : com.sun.activation.viewers.TextEditor
*/

标签:Activation

收藏

0人收藏

支持

0

反对

0

发表评论