Debian Codegraph @

demo/src/main/java/MCTest.java

raw
1 /*
2 * Copyright (c) 1997, 2019 Oracle and/or its affiliates. All rights reserved.
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Distribution License v. 1.0, which is available at
6 * http://www.eclipse.org/org/documents/edl-v10.php.
7 *
8 * SPDX-License-Identifier: BSD-3-Clause
9 */
10
11 import java.io.*;
12 import java.beans.*;
13 import com.sun.activation.registries.*;
14 import jakarta.activation.*;
15
16 public class MCTest {
17 static MailcapCommandMap mcf = null;
18
19 public static void main(String args[]) {
20
21 try {
22 if (args.length == 0)
23 mcf = new MailcapCommandMap();
24 else
25 mcf = new MailcapCommandMap(args[0]);
26 } catch (Exception e){
27 e.printStackTrace();
28 System.exit(1);
29 }
30
31 CommandInfo cmdinfo[] = mcf.getAllCommands("text/plain");
32 System.out.print("Are there any commands for text/plain?");
33
34 if (cmdinfo != null) {
35 System.out.println("number of cmds = " + cmdinfo.length);
36 System.out.println("now try an individual cmd");
37 CommandInfo info = mcf.getCommand("text/plain", "view");
38 if (info != null) {
39 System.out.println("Got command...");
40 } else {
41 System.out.println("no cmds");
42 }
43
44 mcf.addMailcap("text/plain;; x-java-flobotz=com.sun.activation.flobotz\n");
45 // System.out.println("...dome");
46 if (cmdinfo != null) {
47 cmdinfo = mcf.getAllCommands("text/plain");
48 System.out.println("now we have cmds = " + cmdinfo.length);
49
50 }
51
52 } else {
53 System.out.println("NO CMDS AT ALL!");
54 }
55 }
56 }