package com.xagasoft.gats; import java.io.InputStream; import java.io.OutputStream; public class GatsString extends GatsObject { private byte[] aValue = null; public GatsString() { } public GatsString( String sValue ) { this.aValue = sValue.getBytes(); } public GatsString( byte[] aValue ) { this.aValue = aValue; } public byte[] getValue() { return aValue; } public void setValue( String sValue ) { this.aValue = sValue.getBytes(); } public void setValue( byte[] aValue ) { this.aValue = aValue; } public String toString() { return new String( aValue ); } public int getType() { return GatsObject.STRING; } public void read( InputStream is, char cType ) throws java.io.IOException { long lSize = GatsInteger.readPackedInt( is ); aValue = new byte[(int)lSize]; is.read( aValue ); } public void write( OutputStream os ) throws java.io.IOException { os.write( (int)'s' ); if( aValue == null ) { GatsInteger.writePackedInt( os, 0 ); } else { GatsInteger.writePackedInt( os, aValue.length ); os.write( aValue ); } } };