Package com.mongodb
Class MongoCompressor
java.lang.Object
com.mongodb.MongoCompressor
Metadata describing a compressor to use for sending and receiving messages to a MongoDB server.
- Since:
- 3.6
- Since server release
- 3.4
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionstatic MongoCompressorCreate an instance for snappy compression.static MongoCompressorCreate an instance for zlib compression.static MongoCompressorCreate an instance for zstd compression.booleangetName()Gets the name of the compressor.<T> TgetProperty(String key, T defaultValue) Gets the property with the given key.<T> TgetPropertyNonNull(String key, T defaultValue) Gets the property with the given key.inthashCode()toString()<T> MongoCompressorwithProperty(String key, T value) Creates a new compressor from this compressor with the given property added to it.
- 
Field Details- 
LEVELThe property key for defining the compression level.- See Also:
 
 
- 
- 
Method Details- 
createSnappyCompressorCreate an instance for snappy compression.- Returns:
- A compressor based on the snappy compression algorithm
- Since server release
- 3.4
 
- 
createZlibCompressorCreate an instance for zlib compression.- Returns:
- A compressor based on the zlib compression algorithm
- Since server release
- 3.6
 
- 
createZstdCompressorCreate an instance for zstd compression.- Returns:
- A compressor based on the zstd compression algorithm
- Since server release
- 4.2
 
- 
getNameGets the name of the compressor.- Returns:
- the non-null compressor name
 
- 
getPropertyGets the property with the given key.- Type Parameters:
- T- the property value type
- Parameters:
- key- the key
- defaultValue- the default value
- Returns:
- the property value, or the default value if the property is not defined
 
- 
getPropertyNonNullGets the property with the given key.- Type Parameters:
- T- the property value type
- Parameters:
- key- the key
- defaultValue- the default value
- Returns:
- the property value, or the default value if the property is not defined
- Throws:
- IllegalArgumentException- if the value and default value are null
- Since:
- 3.7
 
- 
withPropertyCreates a new compressor from this compressor with the given property added to it.- Type Parameters:
- T- the property value type
- Parameters:
- key- the property key
- value- the property value
- Returns:
- the new compressor
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString
 
-