Class AesCipherDataSink
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.crypto.AesCipherDataSink
-
- All Implemented Interfaces:
DataSink
@Deprecated public final class AesCipherDataSink extends Object implements DataSink
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.A wrappingDataSinkthat encrypts the data being consumed.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.upstream.DataSink
DataSink.Factory
-
-
Constructor Summary
Constructors Constructor Description AesCipherDataSink(byte[] secretKey, DataSink wrappedDataSink)Deprecated.Create an instance whosewritemethods have the side effect of overwriting the inputdata.AesCipherDataSink(byte[] secretKey, DataSink wrappedDataSink, byte[] scratch)Deprecated.Create an instance whosewritemethods are free of side effects.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Deprecated.Closes the sink.voidopen(DataSpec dataSpec)Deprecated.Opens the sink to consume the specified data.voidwrite(byte[] buffer, int offset, int length)Deprecated.Consumes the provided data.
-
-
-
Constructor Detail
-
AesCipherDataSink
public AesCipherDataSink(byte[] secretKey, DataSink wrappedDataSink)Deprecated.Create an instance whosewritemethods have the side effect of overwriting the inputdata. Use this constructor for maximum efficiency in the case that there is no requirement for the input data arrays to remain unchanged.- Parameters:
secretKey- The key data.wrappedDataSink- The wrappedDataSink.
-
AesCipherDataSink
public AesCipherDataSink(byte[] secretKey, DataSink wrappedDataSink, @Nullable byte[] scratch)Deprecated.Create an instance whosewritemethods are free of side effects. Use this constructor when the input data arrays are required to remain unchanged.- Parameters:
secretKey- The key data.wrappedDataSink- The wrappedDataSink.scratch- Scratch space. Data is encrypted into this array before being written to the wrappedDataSink. It should be of appropriate size for the expected writes. If a write is larger than the size of this array the write will still succeed, but multiple cipher calls will be required to complete the operation. Ifnullthen encryption will overwrite the inputdata.
-
-
Method Detail
-
open
public void open(DataSpec dataSpec) throws IOException
Deprecated.Description copied from interface:DataSinkOpens the sink to consume the specified data.Note: If an
IOExceptionis thrown, callers must still callDataSink.close()to ensure that any partial effects of the invocation are cleaned up.- Specified by:
openin interfaceDataSink- Parameters:
dataSpec- Defines the data to be consumed.- Throws:
IOException- If an error occurs opening the sink.
-
write
public void write(byte[] buffer, int offset, int length) throws IOExceptionDeprecated.Description copied from interface:DataSinkConsumes the provided data.- Specified by:
writein interfaceDataSink- Parameters:
buffer- The buffer from which data should be consumed.offset- The offset of the data to consume inbuffer.length- The length of the data to consume, in bytes.- Throws:
IOException- If an error occurs writing to the sink.
-
close
public void close() throws IOExceptionDeprecated.Description copied from interface:DataSinkCloses the sink.Note: This method must be called even if the corresponding call to
DataSink.open(DataSpec)threw anIOException. SeeDataSink.open(DataSpec)for more details.- Specified by:
closein interfaceDataSink- Throws:
IOException- If an error occurs closing the sink.
-
-