M
- type of Message
that underlying records will usepublic static class TransformedRecordSerializerJCE.Builder<M extends Message> extends TransformedRecordSerializer.Builder<M>
TransformedRecordSerializerJCE
class. The methods
on this builder allows the user to specify parameters that can then be
used to specify which transformations should be applied before serializing
the record. It can also be used to specify parameters that will then be
applied to serialized data before deserializing, though the prefix of
records themselves are what specify the needed transformations.Modifier and Type | Field and Description |
---|---|
protected String |
cipherName |
protected Key |
encryptionKey |
protected SecureRandom |
secureRandom |
compressionLevel, compressWhenSerializing, encryptWhenSerializing, inner
Modifier | Constructor and Description |
---|---|
protected |
Builder(RecordSerializer<M> inner) |
Modifier and Type | Method and Description |
---|---|
TransformedRecordSerializerJCE<M> |
build()
Construct a
TransformedRecordSerializerJCE from the
parameters specified by this builder. |
TransformedRecordSerializerJCE.Builder<M> |
clearEncryption()
Clears a previously specified key and provider that
might have been passed to this
Builder . |
TransformedRecordSerializerJCE.Builder<M> |
clearSecureRandom()
Clears a previously set secure random number generator
that might have been passed to this
Builder . |
TransformedRecordSerializerJCE.Builder<M> |
setCipherName(String cipherName)
Specifies the cipher algorithm used to encrypt or
decrypt a record.
|
TransformedRecordSerializerJCE.Builder<M> |
setCompressionLevel(int level)
Compression level to use if compressing.
|
TransformedRecordSerializerJCE.Builder<M> |
setCompressWhenSerializing(boolean compressWhenSerializing)
Whether to compress records after serializing.
|
TransformedRecordSerializerJCE.Builder<M> |
setEncryptionKey(Key encryptionKey)
Specifies the encryption key used to encrypt or
decrypt a record.
|
TransformedRecordSerializerJCE.Builder<M> |
setEncryptWhenSerializing(boolean encryptWhenSerializing)
Whether to encrypt records after serializing.
|
TransformedRecordSerializerJCE.Builder<M> |
setSecureRandom(SecureRandom secureRandom)
Sets the secure random number generator used during
cryptographic operations.
|
@Nullable protected SecureRandom secureRandom
protected Builder(@Nonnull RecordSerializer<M> inner)
public TransformedRecordSerializerJCE.Builder<M> setCompressWhenSerializing(boolean compressWhenSerializing)
TransformedRecordSerializer.Builder
TransformedRecordSerializer.Builder.setCompressionLevel(int)
.setCompressWhenSerializing
in class TransformedRecordSerializer.Builder<M extends Message>
compressWhenSerializing
- true
if records should be compressed and false
otherwiseBuilder
public TransformedRecordSerializerJCE.Builder<M> setCompressionLevel(int level)
TransformedRecordSerializer.Builder
Deflater
class (which
are the same levels as used by zlib). The higher the level,
the better the compression will be but the slower or more
CPU intensive it will be. The default level if none is
set here is . Setting
this does not automatically enable compression when
serializing.setCompressionLevel
in class TransformedRecordSerializer.Builder<M extends Message>
level
- the compression level (0-9)Builder
Deflater
public TransformedRecordSerializerJCE.Builder<M> setEncryptWhenSerializing(boolean encryptWhenSerializing)
setEncryptionKey(Key)
to specify the encryption key.setEncryptWhenSerializing
in class TransformedRecordSerializer.Builder<M extends Message>
encryptWhenSerializing
- true
if records should be encrypted and false
otherwiseBuilder
public TransformedRecordSerializerJCE.Builder<M> setEncryptionKey(@Nonnull Key encryptionKey)
RecordSerializationException
.encryptionKey
- key to supply to encryption methodBuilder
public TransformedRecordSerializerJCE.Builder<M> setCipherName(@Nonnull String cipherName)
AES/CBC/PKCS5Padding
.cipherName
- name of the cipher algorithm to useBuilder
public TransformedRecordSerializerJCE.Builder<M> clearEncryption()
Builder
.Builder
public TransformedRecordSerializerJCE.Builder<M> setSecureRandom(@Nonnull SecureRandom secureRandom)
TransformedRecordSerializerJCE
is built.secureRandom
- a secure random number generatorBuilder
public TransformedRecordSerializerJCE.Builder<M> clearSecureRandom()
Builder
.Builder
public TransformedRecordSerializerJCE<M> build()
TransformedRecordSerializerJCE
from the
parameters specified by this builder. If one has enabled
encryption at serialization time, then this will fail
with an RecordCoreArgumentException
.build
in class TransformedRecordSerializer.Builder<M extends Message>
TransformedRecordSerializerJCE
from this Builder
RecordCoreArgumentException
- if encryption is enabled when serializing but no encryption is specified