Annotation of OpenXM/src/OpenMath/ORG/openxm/tam/CMO_STRING.java, Revision 1.1
1.1 ! tam 1: /**
! 2: * $OpenXM$
! 3: */
! 4: package ORG.openxm.tam;
! 5:
! 6: import java.io.*;
! 7:
! 8: /**
! 9: * CMO $B7A<0$N(B STRING $B7?$rI=$7$^$9(B.
! 10: */
! 11: final public class CMO_STRING extends CMO{
! 12: private String str = null;
! 13:
! 14: /**
! 15: * $B6uJ8;zNs$rFbMF$H$9$k(B STRING $B$r:n@.$7$^$9(B.
! 16: */
! 17: public CMO_STRING(){
! 18: str = null;
! 19: }
! 20:
! 21: /**
! 22: * $BJ8;zNs(B a $B$rFbMF$H$9$k(B STRING $B$r:n@.$7$^$9(B.
! 23: */
! 24: public CMO_STRING(String a){
! 25: str = a;
! 26: }
! 27:
! 28: /**
! 29: * $BFbMF$NJ8;zNs$rF@$^$9(B.
! 30: */
! 31: public String getString(){
! 32: return str;
! 33: }
! 34:
! 35: public int DISCRIMINATOR(){
! 36: return CMO.STRING;
! 37: }
! 38:
! 39: protected void sendByObject(OpenXMconnection os) throws IOException{
! 40: byte[] buf = str.getBytes();
! 41:
! 42: os.writeInt(buf.length);
! 43: for(int i=0;i<buf.length;i++){
! 44: os.writeByte(buf[i]);
! 45: }
! 46: }
! 47:
! 48: static protected CMO receive(OpenXMconnection is) throws IOException{
! 49: int len;
! 50: byte[] buf=null;
! 51:
! 52: len=is.readInt();
! 53: if(len==0){
! 54: return new CMO_STRING("");
! 55: }
! 56:
! 57: buf = new byte[len];
! 58: for(int i=0;i<len;i++){
! 59: buf[i] = is.readByte();
! 60: }
! 61:
! 62: return new CMO_STRING(new String(buf));
! 63: }
! 64:
! 65: protected String toCMOexpressionByObject(){
! 66: return "CMO_STRING,"+ str.length() +","+ str;
! 67: }
! 68: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>