1 31 32 package org.antlr.xjlib.appkit.document; 33 34 import org.antlr.xjlib.foundation.XJUtils; 35 36 import java.io.FileOutputStream ; 37 import java.io.IOException ; 38 import java.io.OutputStream ; 39 40 public class XJDataPlainText extends XJData { 41 42 public String text; 43 44 public int dataType() { 45 return DATA_PLAINTEXT; 46 } 47 48 public void readData() throws IOException , ClassNotFoundException { 49 text = XJUtils.getStringFromFile(getFile()); 50 } 51 52 public void writeData() throws IOException { 53 OutputStream os = new FileOutputStream (getFile()); 54 os.write(text.getBytes()); 55 os.close(); 56 } 57 58 public void setText(String text) { 59 this.text = text; 60 } 61 62 public String getText() { 63 return text; 64 } 65 66 } 67 | Popular Tags |