Created
August 29, 2022 12:08
-
-
Save cp-hardik-p/bcf5c6fc0225d630fd60a6c64cc2a927 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object EmployeePreferencesSerializer : Serializer<EmployeePreference> { | |
| override val defaultValue: EmployeePreference = EmployeePreference.getDefaultInstance() | |
| @Suppress("BlockingMethodInNonBlockingContext") | |
| override suspend fun readFrom(input: InputStream): EmployeePreference { | |
| try { | |
| return EmployeePreference.parseFrom(input) | |
| } catch (exception: InvalidProtocolBufferException) { | |
| throw CorruptionException("Cannot read proto.", exception) | |
| } | |
| } | |
| @Suppress("BlockingMethodInNonBlockingContext") | |
| override suspend fun writeTo(t: EmployeePreference, output: OutputStream) = t.writeTo(output) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment