Xindice API
version 1.1

org.apache.xindice.core.data
Class Value

java.lang.Object
  |
  +--org.apache.xindice.core.data.Value
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
Key

public class Value
extends Object
implements Comparable

Value is the primary base class for all data storing objects. The content window of Value objects are immutable, but the underlying byte array is not.

Version:
$Revision: 527706 $, $Date: 2007-04-11 18:18:07 -0400 (Wed, 11 Apr 2007) $

Field Summary
protected  byte[] data
           
protected  int len
           
protected  int pos
           
 
Constructor Summary
Value(byte[] data)
           
Value(byte[] data, int pos, int len)
           
Value(String data)
           
Value(Value value)
           
 
Method Summary
 byte byteAt(int index)
          Returns the byte at the specified index.
 int compareTo(Object obj)
           
 int compareTo(Value value)
           
 void copyTo(byte[] tdata, int tpos)
          Copy contents of the value into supplied byte array.
 void copyTo(byte[] tdata, int tpos, int len)
          Copy len bytes of value's content into supplied byte array.
 boolean equals(Object obj)
           
 boolean equals(Value value)
           
 byte[] getData()
          getData retrieves the data being stored by the Value as a byte array.
 InputStream getInputStream()
          Return an InputStream for the value.
 int getLength()
          getLength retrieves the length of the data being stored by the Value.
 Value getSubvalue(int start, int len)
          Get a new Value that is part of this Value object.
 int hashCode()
           
 boolean startsWith(Value value)
           
 void streamTo(OutputStream out)
          Stream the content of the value into an OutputStream.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected byte[] data

pos

protected int pos

len

protected int len
Constructor Detail

Value

public Value(Value value)

Value

public Value(byte[] data)

Value

public Value(byte[] data,
             int pos,
             int len)

Value

public Value(String data)
Method Detail

getLength

public final int getLength()
getLength retrieves the length of the data being stored by the Value.
Returns:
The Value length

getData

public final byte[] getData()
getData retrieves the data being stored by the Value as a byte array.
Returns:
The Data

getSubvalue

public final Value getSubvalue(int start,
                               int len)
Get a new Value that is part of this Value object.
Parameters:
start - beginning index
len - length of the new Value
Returns:
Value object
Throws:
ArrayIndexOutOfBoundsException - if start index is either negative or isn't less then length of original Value

byteAt

public final byte byteAt(int index)
Returns the byte at the specified index.
Parameters:
index - byte index
Returns:
the byte at the specified index.
Throws:
ArrayIndexOutOfBoundsException - if index is negative number or is not less that the length of Value data

startsWith

public final boolean startsWith(Value value)

getInputStream

public final InputStream getInputStream()
Return an InputStream for the value.
Returns:
An InputStream

streamTo

public final void streamTo(OutputStream out)
                    throws IOException
Stream the content of the value into an OutputStream.
Parameters:
out - the OutputStream

copyTo

public final void copyTo(byte[] tdata,
                         int tpos)
Copy contents of the value into supplied byte array.
Parameters:
tdata - byte array for the value
tpos - starting position

copyTo

public final void copyTo(byte[] tdata,
                         int tpos,
                         int len)
Copy len bytes of value's content into supplied byte array.
Parameters:
tdata - byte array for the value
tpos - starting position
len - count of bytes to copy

compareTo

public final int compareTo(Value value)

compareTo

public final int compareTo(Object obj)
Specified by:
compareTo in interface Comparable

equals

public boolean equals(Value value)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public final String toString()
Overrides:
toString in class Object

Xindice API
version 1.1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.