Stay organized with collections
Save and categorize content based on your preferences.
Pattern
class Pattern
Metadata describing an encryption pattern for the protected bytes in a subsample. An encryption pattern consists of a repeating sequence of crypto blocks comprised of a number of encrypted blocks followed by a number of unencrypted, or skipped, blocks.
Summary
Public constructors |
Construct a sample encryption pattern given the number of blocks to encrypt and skip in the pattern.
|
Public methods |
Int |
Return the number of blocks to encrypt in a sample encryption pattern.
|
Int |
Return the number of blocks to skip in a sample encryption pattern.
|
Unit |
Set the number of blocks to encrypt and skip in a sample encryption pattern.
|
Public constructors
Pattern
Pattern(
blocksToEncrypt: Int,
blocksToSkip: Int)
Construct a sample encryption pattern given the number of blocks to encrypt and skip in the pattern. If both parameters are zero, pattern encryption is inoperative.
Public methods
getEncryptBlocks
fun getEncryptBlocks(): Int
Return the number of blocks to encrypt in a sample encryption pattern.
getSkipBlocks
fun getSkipBlocks(): Int
Return the number of blocks to skip in a sample encryption pattern.
set
fun set(
blocksToEncrypt: Int,
blocksToSkip: Int
): Unit
Set the number of blocks to encrypt and skip in a sample encryption pattern. If both parameters are zero, pattern encryption is inoperative.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# MediaCodec.CryptoInfo.Pattern\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPattern\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/media/MediaCodec.CryptoInfo.Pattern \"View this page in Java\") \n\n```\nclass Pattern\n```\n\n|---|--------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.media.MediaCodec.CryptoInfo.Pattern](#) |\n\nMetadata describing an encryption pattern for the protected bytes in a subsample. An encryption pattern consists of a repeating sequence of crypto blocks comprised of a number of encrypted blocks followed by a number of unencrypted, or skipped, blocks.\n\nSummary\n-------\n\n| Public constructors ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [Pattern](#Pattern(kotlin.Int,%20kotlin.Int))`(`blocksToEncrypt:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `blocksToSkip:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Construct a sample encryption pattern given the number of blocks to encrypt and skip in the pattern. |\n\n| Public methods ||\n|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getEncryptBlocks](#getEncryptBlocks())`()` Return the number of blocks to encrypt in a sample encryption pattern. |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getSkipBlocks](#getSkipBlocks())`()` Return the number of blocks to skip in a sample encryption pattern. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [set](#set(kotlin.Int,%20kotlin.Int))`(`blocksToEncrypt:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `blocksToSkip:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set the number of blocks to encrypt and skip in a sample encryption pattern. |\n\nPublic constructors\n-------------------\n\n### Pattern\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nPattern(\n blocksToEncrypt: Int, \n blocksToSkip: Int)\n```\n\nConstruct a sample encryption pattern given the number of blocks to encrypt and skip in the pattern. If both parameters are zero, pattern encryption is inoperative.\n\nPublic methods\n--------------\n\n### getEncryptBlocks\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getEncryptBlocks(): Int\n```\n\nReturn the number of blocks to encrypt in a sample encryption pattern. \n\n### getSkipBlocks\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getSkipBlocks(): Int\n```\n\nReturn the number of blocks to skip in a sample encryption pattern. \n\n### set\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun set(\n blocksToEncrypt: Int, \n blocksToSkip: Int\n): Unit\n```\n\nSet the number of blocks to encrypt and skip in a sample encryption pattern. If both parameters are zero, pattern encryption is inoperative."]]