java.lang.Object
org.elasticsearch.common.compress.CompressedXContent
- All Implemented Interfaces:
Writeable
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.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Constructor Summary
ConstructorsConstructorDescriptionCompressedXContent(byte[] data) CompressedXContent(String str) CompressedXContent(Map<String, Object> map) Create aCompressedXContentout of a serializedToXContentthat may already be compressed.CompressedXContent(ToXContent xcontent) CompressedXContent(ToXContent xcontent, ToXContent.Params params) Create aCompressedXContentout of aToXContentinstance. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Return the compressed bytes.Return the compressed bytes as aBytesReference.voidcopyTo(XContentBuilder builder) Copies the x-content in this instance to the given builder token by token.booleanstatic CompressedXContentParses the given JSON string and then serializes it back in compressed form without any whitespaces.inthashCode()static CompressedXContentstring()toString()Return the uncompressed bytes.voidwriteTo(StreamOutput out) Write this into the StreamOutput.
-
Constructor Details
-
CompressedXContent
- Throws:
IOException
-
CompressedXContent
- Throws:
IOException
-
CompressedXContent
Create aCompressedXContentout of aToXContentinstance.- Throws:
IOException
-
CompressedXContent
Create aCompressedXContentout of a serializedToXContentthat 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
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
equals
-
copyTo
Copies the x-content in this instance to the given builder token by token. This operation is equivalent to parsing the contents of this instance into a map and then writing the map to the givenXContentBuilderfunctionally but is much more efficient.- Parameters:
builder- builder to copy to- Throws:
IOException- on failure
-
hashCode
public int hashCode() -
toString
-