|
Last change
on this file since 126 was
89,
checked in by sherbold, 15 years ago
|
|
|
-
Property svn:mime-type set to
text/plain
|
|
File size:
968 bytes
|
| Line | |
|---|
| 1 | package de.ugoe.cs.eventbench.commands;
|
|---|
| 2 |
|
|---|
| 3 | import java.io.FileInputStream;
|
|---|
| 4 | import java.io.IOException;
|
|---|
| 5 | import java.io.ObjectInputStream;
|
|---|
| 6 | import java.security.InvalidParameterException;
|
|---|
| 7 | import java.util.List;
|
|---|
| 8 |
|
|---|
| 9 | import de.ugoe.cs.util.console.Command;
|
|---|
| 10 | import de.ugoe.cs.util.console.Console;
|
|---|
| 11 |
|
|---|
| 12 | public 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.