mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-20 15:24:45 +08:00
Deprecate ExternalImage
constructors
This commit is contained in:
parent
9ed1025e30
commit
644f0f175b
@ -39,23 +39,27 @@ class ExternalImage private constructor(
|
||||
val input: Any, // Input from kotlinx.io, InputStream from kotlinx.io MPP, ByteReadChannel from ktor
|
||||
val inputSize: Long // dont be greater than Int.MAX
|
||||
) {
|
||||
@Deprecated("changing soon in 1.0.0", level = DeprecationLevel.ERROR)
|
||||
constructor(
|
||||
md5: ByteArray,
|
||||
input: ByteReadChannel,
|
||||
inputSize: Long // dont be greater than Int.MAX
|
||||
) : this(md5, input as Any, inputSize)
|
||||
|
||||
@Deprecated("changing soon in 1.0.0", level = DeprecationLevel.ERROR)
|
||||
constructor(
|
||||
md5: ByteArray,
|
||||
input: Input,
|
||||
inputSize: Long // dont be greater than Int.MAX
|
||||
) : this(md5, input as Any, inputSize)
|
||||
|
||||
@Deprecated("changing soon in 1.0.0", level = DeprecationLevel.ERROR)
|
||||
constructor(
|
||||
md5: ByteArray,
|
||||
input: ByteReadPacket
|
||||
) : this(md5, input as Any, input.remaining)
|
||||
|
||||
@Deprecated("changing soon in 1.0.0", level = DeprecationLevel.ERROR)
|
||||
@OptIn(InternalSerializationApi::class)
|
||||
constructor(
|
||||
md5: ByteArray,
|
||||
|
@ -62,6 +62,7 @@ fun BufferedImage.toExternalImage(formatName: String = "png"): ExternalImage {
|
||||
})
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
return ExternalImage(digest.digest(), file.inputStream())
|
||||
}
|
||||
|
||||
@ -73,6 +74,7 @@ suspend inline fun BufferedImage.suspendToExternalImage(): ExternalImage = withC
|
||||
@OptIn(MiraiInternalAPI::class)
|
||||
@Throws(IOException::class)
|
||||
fun File.toExternalImage(): ExternalImage {
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
return ExternalImage(
|
||||
md5 = this.inputStream().md5(), // dont change
|
||||
input = this.inputStream()
|
||||
|
Loading…
Reference in New Issue
Block a user