com.sri.oaa2.icl
Class ToWireString

java.lang.Object
  |
  +--com.sri.oaa2.icl.ToWireString
All Implemented Interfaces:
OaaPrologVocabTokenTypes

public final class ToWireString
extends java.lang.Object
implements OaaPrologVocabTokenTypes

Convert an IclTerm into a string suitable for transmission over the wire.


Field Summary
 
Fields inherited from interface com.sri.oaa2.icl.OaaPrologVocabTokenTypes
BACKSLASH, BANG, COLON, COMMA, DBL_COLON, DBLQUOTE, DBLQUOTED, DIV, DOT, ENDPAREN_LITERAL, EOF, EQUAL, EXPONENT, FLOAT, GROUP, ICLDATAQ, ICLDATAQ_LITERAL, IDENT, INT, LBRACE, LBRACK, LIST, LPAREN, MINUS, NULL_TREE_LOOKAHEAD, NUM_FLOAT, NUM_INT, PIPE, PLUS, RBRACE, RBRACK, RPAREN, SEMI, SIGNED_EXPONENT, SPECIAL_CHAR_LITERAL, STAR, STR, STRING_LITERAL, STRUCT, TERM_LITERAL, TILDE, TURNSTILE, VAR, VARIABLE, WS
 
Constructor Summary
protected ToWireString()
           
 
Method Summary
 void from(IclTerm originalTerm, java.io.DataOutputStream dos)
          Write term as a string on the wire to the given output stream.
static ToWireString getInstance()
          Get an instance of a ToWireString object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToWireString

protected ToWireString()
Method Detail

from

public void from(IclTerm originalTerm,
                 java.io.DataOutputStream dos)
          throws java.io.IOException
Write term as a string on the wire to the given output stream. If you want to write to a string, for instance, you would use something like: IclTerm oneTerm = ...; PipedOutputStream pos = new PipedOutputStream(); PipedInputStream pis = new PipedInputStream(); DataOutputStream dos = new DataOutputStream(pos); BufferedReader bpis = new BufferedReader(new InputStreamReader(pis)); pos.connect(pis); ToWireString.getInstance().from(oneTerm, dos); dos.writeBytes("\n"); String s = bpis.readLine();

java.io.IOException

getInstance

public static ToWireString getInstance()
Get an instance of a ToWireString object. This avoids multiple calls to the constructor. ToWireString is thread safe.