org.opencyc.cycobject
Class ByteArray

java.lang.Object
  |
  +--org.opencyc.cycobject.ByteArray

public class ByteArray
extends java.lang.Object

Contains an array of bytes, as an object that directly represents a SubL byte vector. The primitive element in java is a byte having a signed numerical value between -128 and +127. The corresponding primitive element in SubL is a byte having an unsigned numerical value between 0 and 255.

The ByteArray object can only be used in the OpenCyc binary api because it does not have a string representation in either SubL or java.

Author:
Bjørn Aldag

Copyright 2001 Cycorp, Inc., license is open source GNU LGPL.

the license

www.opencyc.org

OpenCyc at SourceForge

THIS SOFTWARE AND KNOWLEDGE BASE CONTENT ARE PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENCYC ORGANIZATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE AND KNOWLEDGE BASE CONTENT, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Field Summary
static java.lang.String byteVectorXMLTag
          the name of the XML tag for Cyc byte-vector objects
static java.lang.String byteXMLTag
          the name of the XML tag for the byte elements of Cyc byte-vector objects
static int indentLength
          the default indentation for printing CycConstant objects to XML
static java.lang.String lengthXMLTag
          the name of the XML tag for the length of Cyc byte-vector objects
 
Constructor Summary
ByteArray(byte[] bytes)
          Creates a new byte array from the specified array of bytes.
 
Method Summary
 byte[] byteArrayValue()
          Returns the array of bytes of this ByteArray.
 boolean equals(java.lang.Object object)
          Returns true iff some object equals this ByteArray
 java.lang.String toString()
          Returns the string representation of the ByteArray
 void toXML(XMLWriter xmlWriter, int indent, boolean relative)
          Prints the XML representation of this ByteArray to an XMLWriter
 java.lang.String toXMLString()
          Marshalls this ByteArray object into its CYC-ML XML expression.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

byteVectorXMLTag

public static final java.lang.String byteVectorXMLTag
the name of the XML tag for Cyc byte-vector objects

lengthXMLTag

public static final java.lang.String lengthXMLTag
the name of the XML tag for the length of Cyc byte-vector objects

byteXMLTag

public static final java.lang.String byteXMLTag
the name of the XML tag for the byte elements of Cyc byte-vector objects

indentLength

public static int indentLength
the default indentation for printing CycConstant objects to XML
Constructor Detail

ByteArray

public ByteArray(byte[] bytes)
Creates a new byte array from the specified array of bytes.
Method Detail

byteArrayValue

public byte[] byteArrayValue()
Returns the array of bytes of this ByteArray.
Returns:
the array of bytes of this ByteArray.

equals

public boolean equals(java.lang.Object object)
Returns true iff some object equals this ByteArray
Overrides:
equals in class java.lang.Object
Parameters:
object - the Object for equality comparison
Returns:
equals boolean value indicating equality or non-equality.

toString

public java.lang.String toString()
Returns the string representation of the ByteArray
Overrides:
toString in class java.lang.Object
Returns:
the representation of the ByteArray as a String

toXMLString

public java.lang.String toXMLString()
                             throws java.io.IOException
Marshalls this ByteArray object into its CYC-ML XML expression.
Returns:
the CYC-ML XML representation string

toXML

public void toXML(XMLWriter xmlWriter,
                  int indent,
                  boolean relative)
           throws java.io.IOException
Prints the XML representation of this ByteArray to an XMLWriter
Parameters:
xmlWriter - an XMLWriter
indent - an int that specifies by how many spaces to indent
relative - a boolean; if true indentation is relative, otherwise absolute