| 1 |
|
| 2 |
package org.freehep.graphicsio.cgm; |
| 3 |
|
| 4 |
import java.io.IOException; |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
public class Message extends CGMTag { |
| 14 |
|
| 15 |
public final static int NO_ACTION = 0; |
| 16 |
|
| 17 |
public final static int ACTION = 1; |
| 18 |
|
| 19 |
private int action; |
| 20 |
|
| 21 |
private String message; |
| 22 |
|
| 23 |
public Message() { |
| 24 |
super(7, 1, 1); |
| 25 |
} |
| 26 |
|
| 27 |
public Message(int action, String message) { |
| 28 |
this(); |
| 29 |
this.action = action; |
| 30 |
this.message = message; |
| 31 |
} |
| 32 |
|
| 33 |
public void write(int tagID, CGMOutputStream cgm) throws IOException { |
| 34 |
cgm.writeEnumerate(action); |
| 35 |
cgm.writeString(message); |
| 36 |
} |
| 37 |
|
| 38 |
public void write(int tagID, CGMWriter cgm) throws IOException { |
| 39 |
cgm.print("MESSAGE "); |
| 40 |
cgm.print((action == NO_ACTION) ? "NOACTION" : "ACTION"); |
| 41 |
cgm.println(); |
| 42 |
cgm.writeString(message); |
| 43 |
} |
| 44 |
} |