Class CompressedXContent
java.lang.Object
org.elasticsearch.common.compress.CompressedXContent
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
ConstructorDescriptionCompressedXContent
(byte[] data) CompressedXContent
(String str) Create aCompressedXContent
out of a serializedToXContent
that may already be compressed.CompressedXContent
(org.elasticsearch.xcontent.ToXContent xcontent) CompressedXContent
(org.elasticsearch.xcontent.ToXContent xcontent, org.elasticsearch.xcontent.ToXContent.Params params) Create aCompressedXContent
out of aToXContent
instance. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Return the compressed bytes.Return the compressed bytes as aBytesReference
.boolean
static CompressedXContent
Parses the given JSON string and then serializes it back in compressed form without any whitespaces.int
hashCode()
static CompressedXContent
string()
toString()
Return the uncompressed bytes.void
writeTo
(StreamOutput out)
-
Constructor Details
-
CompressedXContent
- Throws:
IOException
-
CompressedXContent
public CompressedXContent(org.elasticsearch.xcontent.ToXContent xcontent, org.elasticsearch.xcontent.ToXContent.Params params) throws IOException Create aCompressedXContent
out of aToXContent
instance.- Throws:
IOException
-
CompressedXContent
Create aCompressedXContent
out of a serializedToXContent
that may already be compressed.- Throws:
IOException
-
CompressedXContent
- Throws:
IOException
-
CompressedXContent
- Throws:
IOException
-
-
Method Details
-
fromJSON
Parses the given JSON string and then serializes it back in compressed form without any whitespaces. This is used to normalize mapping json strings for deduplication.- Parameters:
json
- string containing valid JSON- Returns:
- compressed x-content normalized to not contain any whitespaces
- Throws:
IOException
-
compressed
public byte[] compressed()Return the compressed bytes. -
compressedReference
Return the compressed bytes as aBytesReference
. -
uncompressed
Return the uncompressed bytes. -
string
-
getSha256
-
readCompressedString
- Throws:
IOException
-
writeTo
- Throws:
IOException
-
equals
-
hashCode
public int hashCode() -
toString
-