Example usage for javax.activation MailcapCommandMap getAllCommands

List of usage examples for javax.activation MailcapCommandMap getAllCommands

Introduction

In this page you can find the example usage for javax.activation MailcapCommandMap getAllCommands.

Prototype

public synchronized CommandInfo[] getAllCommands(String mimeType) 

Source Link

Document

Get all the available commands in all mailcap files known to this instance of MailcapCommandMap for this MIME type.

Usage

From source file:MailcapCommandMapDemo1.java

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());
        }/*from w  w  w  . ja v a2 s  .  c  o  m*/
    }
}

From source file:Main.java

public static void main(String[] args) {
    MailcapCommandMap mailcapCommandMap = new MailcapCommandMap();
    String mailcap = "text/plain;" + "x-java-content-handler=beans.TextHandler;"
            + "x-java-view=beans.TextViewer;" + "x-java-edit=beans.TextEditor";
    mailcapCommandMap.addMailcap(mailcap);

    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());
        }/* ww  w. jav a2  s.  c  o m*/
    }
}

From source file:MailcapCommandMapDemo2.java

public static void main(String[] args) {
    MailcapCommandMap mailcapCommandMap = new MailcapCommandMap();
    String mailcap = "text/plain;; " + "x-java-content-handler=beans.TextHandler;"
            + "x-java-view=beans.TextViewer;" + "x-java-edit=beans.TextEditor";
    mailcapCommandMap.addMailcap(mailcap);
    // Get all MIME types
    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());
        }// w  w w.j  a v  a  2 s. co  m
    }
}