Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
644f0f17
Commit
644f0f17
authored
Apr 29, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate `ExternalImage` constructors
parent
9ed1025e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt
.../commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt
+4
-0
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/ExternalImageJvm.kt
.../jvmMain/kotlin/net/mamoe/mirai/utils/ExternalImageJvm.kt
+2
-0
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt
View file @
644f0f17
...
@@ -39,23 +39,27 @@ class ExternalImage private constructor(
...
@@ -39,23 +39,27 @@ class ExternalImage private constructor(
val
input
:
Any
,
// Input from kotlinx.io, InputStream from kotlinx.io MPP, ByteReadChannel from ktor
val
input
:
Any
,
// Input from kotlinx.io, InputStream from kotlinx.io MPP, ByteReadChannel from ktor
val
inputSize
:
Long
// dont be greater than Int.MAX
val
inputSize
:
Long
// dont be greater than Int.MAX
)
{
)
{
@Deprecated
(
"changing soon in 1.0.0"
,
level
=
DeprecationLevel
.
ERROR
)
constructor
(
constructor
(
md5
:
ByteArray
,
md5
:
ByteArray
,
input
:
ByteReadChannel
,
input
:
ByteReadChannel
,
inputSize
:
Long
// dont be greater than Int.MAX
inputSize
:
Long
// dont be greater than Int.MAX
)
:
this
(
md5
,
input
as
Any
,
inputSize
)
)
:
this
(
md5
,
input
as
Any
,
inputSize
)
@Deprecated
(
"changing soon in 1.0.0"
,
level
=
DeprecationLevel
.
ERROR
)
constructor
(
constructor
(
md5
:
ByteArray
,
md5
:
ByteArray
,
input
:
Input
,
input
:
Input
,
inputSize
:
Long
// dont be greater than Int.MAX
inputSize
:
Long
// dont be greater than Int.MAX
)
:
this
(
md5
,
input
as
Any
,
inputSize
)
)
:
this
(
md5
,
input
as
Any
,
inputSize
)
@Deprecated
(
"changing soon in 1.0.0"
,
level
=
DeprecationLevel
.
ERROR
)
constructor
(
constructor
(
md5
:
ByteArray
,
md5
:
ByteArray
,
input
:
ByteReadPacket
input
:
ByteReadPacket
)
:
this
(
md5
,
input
as
Any
,
input
.
remaining
)
)
:
this
(
md5
,
input
as
Any
,
input
.
remaining
)
@Deprecated
(
"changing soon in 1.0.0"
,
level
=
DeprecationLevel
.
ERROR
)
@OptIn
(
InternalSerializationApi
::
class
)
@OptIn
(
InternalSerializationApi
::
class
)
constructor
(
constructor
(
md5
:
ByteArray
,
md5
:
ByteArray
,
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/ExternalImageJvm.kt
View file @
644f0f17
...
@@ -62,6 +62,7 @@ fun BufferedImage.toExternalImage(formatName: String = "png"): ExternalImage {
...
@@ -62,6 +62,7 @@ fun BufferedImage.toExternalImage(formatName: String = "png"): ExternalImage {
})
})
}
}
@Suppress
(
"DEPRECATION_ERROR"
)
return
ExternalImage
(
digest
.
digest
(),
file
.
inputStream
())
return
ExternalImage
(
digest
.
digest
(),
file
.
inputStream
())
}
}
...
@@ -73,6 +74,7 @@ suspend inline fun BufferedImage.suspendToExternalImage(): ExternalImage = withC
...
@@ -73,6 +74,7 @@ suspend inline fun BufferedImage.suspendToExternalImage(): ExternalImage = withC
@OptIn
(
MiraiInternalAPI
::
class
)
@OptIn
(
MiraiInternalAPI
::
class
)
@Throws
(
IOException
::
class
)
@Throws
(
IOException
::
class
)
fun
File
.
toExternalImage
():
ExternalImage
{
fun
File
.
toExternalImage
():
ExternalImage
{
@Suppress
(
"DEPRECATION_ERROR"
)
return
ExternalImage
(
return
ExternalImage
(
md5
=
this
.
inputStream
().
md5
(),
// dont change
md5
=
this
.
inputStream
().
md5
(),
// dont change
input
=
this
.
inputStream
()
input
=
this
.
inputStream
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment