source: trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDload.java @ 131

Last change on this file since 131 was 89, checked in by sherbold, 14 years ago
  • minor changes
  • Property svn:mime-type set to text/plain
File size: 968 bytes
Line 
1package de.ugoe.cs.eventbench.commands;
2
3import java.io.FileInputStream;
4import java.io.IOException;
5import java.io.ObjectInputStream;
6import java.security.InvalidParameterException;
7import java.util.List;
8
9import de.ugoe.cs.util.console.Command;
10import de.ugoe.cs.util.console.Console;
11
12public class CMDload implements Command {
13
14        @Override
15        public void run(List<Object> parameters) {
16                String filename;
17                try {
18                        filename = (String) parameters.get(0);
19                } catch (Exception e) {
20                        throw new InvalidParameterException();
21                }
22
23                FileInputStream fis = null;
24                ObjectInputStream in = null;
25                try {
26                        fis = new FileInputStream(filename);
27                        in = new ObjectInputStream(fis);
28                        in.readObject();
29                        in.close();
30                } catch (IOException ex) {
31                        ex.printStackTrace();
32                } catch (ClassNotFoundException ex) {
33                        ex.printStackTrace();
34                }
35        }
36
37        @Override
38        public void help() {
39                Console.println("Usage: loadObject <filename>");
40        }
41       
42}
Note: See TracBrowser for help on using the repository browser.