org.elasticsearch.common.bytes
Class HashedBytesArray

java.lang.Object
  extended by org.elasticsearch.common.bytes.HashedBytesArray
All Implemented Interfaces:
BytesReference

public class HashedBytesArray
extends Object
implements BytesReference


Constructor Summary
HashedBytesArray(byte[] bytes)
           
HashedBytesArray(String str)
           
 
Method Summary
 byte[] array()
          The underlying byte array (if exists).
 int arrayOffset()
          The offset into the underlying byte array.
 BytesArray copyBytesArray()
          Returns the bytes copied over as a byte array.
 boolean equals(Object o)
           
 byte get(int index)
          Returns the byte at the specified index.
 boolean hasArray()
          Is there an underlying byte array for this bytes reference.
 int hashCode()
           
 int length()
          The length.
 BytesReference slice(int from, int length)
          Slice the bytes from the from index up to length.
 StreamInput streamInput()
          A stream input of the bytes.
 byte[] toBytes()
          Returns the bytes as a single byte array.
 BytesArray toBytesArray()
          Returns the bytes as a byte array, possibly sharing the underlying byte buffer.
 org.jboss.netty.buffer.ChannelBuffer toChannelBuffer()
          Returns the bytes as a channel buffer.
 String toUtf8()
          Converts to a string based on utf8.
 void writeTo(OutputStream os)
          Writes the bytes directly to the output stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HashedBytesArray

public HashedBytesArray(byte[] bytes)

HashedBytesArray

public HashedBytesArray(String str)
Method Detail

get

public byte get(int index)
Description copied from interface: BytesReference
Returns the byte at the specified index. Need to be between 0 and length.

Specified by:
get in interface BytesReference

length

public int length()
Description copied from interface: BytesReference
The length.

Specified by:
length in interface BytesReference

slice

public BytesReference slice(int from,
                            int length)
Description copied from interface: BytesReference
Slice the bytes from the from index up to length.

Specified by:
slice in interface BytesReference

streamInput

public StreamInput streamInput()
Description copied from interface: BytesReference
A stream input of the bytes.

Specified by:
streamInput in interface BytesReference

writeTo

public void writeTo(OutputStream os)
             throws IOException
Description copied from interface: BytesReference
Writes the bytes directly to the output stream.

Specified by:
writeTo in interface BytesReference
Throws:
IOException

toBytes

public byte[] toBytes()
Description copied from interface: BytesReference
Returns the bytes as a single byte array.

Specified by:
toBytes in interface BytesReference

toBytesArray

public BytesArray toBytesArray()
Description copied from interface: BytesReference
Returns the bytes as a byte array, possibly sharing the underlying byte buffer.

Specified by:
toBytesArray in interface BytesReference

copyBytesArray

public BytesArray copyBytesArray()
Description copied from interface: BytesReference
Returns the bytes copied over as a byte array.

Specified by:
copyBytesArray in interface BytesReference

toChannelBuffer

public org.jboss.netty.buffer.ChannelBuffer toChannelBuffer()
Description copied from interface: BytesReference
Returns the bytes as a channel buffer.

Specified by:
toChannelBuffer in interface BytesReference

hasArray

public boolean hasArray()
Description copied from interface: BytesReference
Is there an underlying byte array for this bytes reference.

Specified by:
hasArray in interface BytesReference

array

public byte[] array()
Description copied from interface: BytesReference
The underlying byte array (if exists).

Specified by:
array in interface BytesReference

arrayOffset

public int arrayOffset()
Description copied from interface: BytesReference
The offset into the underlying byte array.

Specified by:
arrayOffset in interface BytesReference

toUtf8

public String toUtf8()
Description copied from interface: BytesReference
Converts to a string based on utf8.

Specified by:
toUtf8 in interface BytesReference

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2009-2012. All Rights Reserved.