Class CompressedXContent
java.lang.Object
org.elasticsearch.common.compress.CompressedXContent
public final class CompressedXContent
extends java.lang.Object
Similar class to the
String
class except that it internally stores
data using a compressed representation in order to require less permanent
memory. Note that the compressed string might still sometimes need to be
decompressed in order to perform equality checks or to compute hash codes.-
Constructor Summary
Constructors Constructor Description CompressedXContent(byte[] data)
CompressedXContent(java.lang.String str)
CompressedXContent(BytesReference data)
Create aCompressedXContent
out of a serializedToXContent
that may already be compressed.CompressedXContent(ToXContent xcontent, XContentType type, ToXContent.Params params)
Create aCompressedXContent
out of aToXContent
instance. -
Method Summary
Modifier and Type Method Description byte[]
compressed()
Return the compressed bytes.BytesReference
compressedReference()
Return the compressed bytes as aBytesReference
.boolean
equals(java.lang.Object o)
int
hashCode()
static CompressedXContent
readCompressedString(StreamInput in)
java.lang.String
string()
java.lang.String
toString()
byte[]
uncompressed()
Return the uncompressed bytes.void
writeTo(StreamOutput out)
-
Constructor Details
-
CompressedXContent
public CompressedXContent(ToXContent xcontent, XContentType type, ToXContent.Params params) throws java.io.IOExceptionCreate aCompressedXContent
out of aToXContent
instance.- Throws:
java.io.IOException
-
CompressedXContent
Create aCompressedXContent
out of a serializedToXContent
that may already be compressed.- Throws:
java.io.IOException
-
CompressedXContent
public CompressedXContent(byte[] data) throws java.io.IOException- Throws:
java.io.IOException
-
CompressedXContent
public CompressedXContent(java.lang.String str) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Details
-
compressed
public byte[] compressed()Return the compressed bytes. -
compressedReference
Return the compressed bytes as aBytesReference
. -
uncompressed
public byte[] uncompressed()Return the uncompressed bytes. -
string
public java.lang.String string() -
readCompressedString
- Throws:
java.io.IOException
-
writeTo
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-