![]() ![]() | ![]() |
File: [local] / OpenXM / src / OpenMath / ORG / openxm / tam / CMO_STRING.java (download)
Revision 1.2, Wed Sep 13 06:32:43 2000 UTC (23 years, 11 months ago) by tam
I changed from OpenXMconnection to OpenXMstream. |
/** * $OpenXM: OpenXM/src/OpenMath/ORG/openxm/tam/CMO_STRING.java,v 1.2 2000/09/13 06:32:43 tam Exp $ */ package ORG.openxm.tam; import java.io.*; /** * CMO $B7A<0$N(B STRING $B7?$rI=$7$^$9(B. */ final public class CMO_STRING extends CMO{ private String str = null; /** * $B6uJ8;zNs$rFbMF$H$9$k(B STRING $B$r:n@.$7$^$9(B. */ public CMO_STRING(){ str = null; } /** * $BJ8;zNs(B a $B$rFbMF$H$9$k(B STRING $B$r:n@.$7$^$9(B. */ public CMO_STRING(String a){ str = a; } /** * $BFbMF$NJ8;zNs$rF@$^$9(B. */ public String getString(){ return str; } public int DISCRIMINATOR(){ return CMO.STRING; } protected void sendByObject(OpenXMstream os) throws IOException{ byte[] buf = str.getBytes(); os.writeInt(buf.length); for(int i=0;i<buf.length;i++){ os.writeByte(buf[i]); } } static protected CMO receive(OpenXMstream is) throws IOException{ int len; byte[] buf=null; len=is.readInt(); if(len==0){ return new CMO_STRING(""); } buf = new byte[len]; for(int i=0;i<len;i++){ buf[i] = is.readByte(); } return new CMO_STRING(new String(buf)); } protected String toCMOexpressionByObject(){ return "CMO_STRING,"+ str.length() +","+ str; } }