Skip to content

Commit

Permalink
refactor(AnkiServer): move getSessionBytes to companion object
Browse files Browse the repository at this point in the history
it already was a static method
  • Loading branch information
BrayanDSO committed Dec 14, 2023
1 parent 54475d9 commit 4daffbe
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions AnkiDroid/src/main/java/com/ichi2/anki/pages/AnkiServer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ open class AnkiServer(
}
}

fun getSessionBytes(session: IHTTPSession): ByteArray {
val contentLength = session.headers["content-length"]!!.toInt()
val bytes = ByteArray(contentLength)
session.inputStream.read(bytes, 0, contentLength)
return bytes
}

fun buildResponse(
block: suspend CoroutineScope.() -> ByteArray
): Response {
Expand Down Expand Up @@ -135,6 +128,13 @@ open class AnkiServer(
}
}

fun getSessionBytes(session: IHTTPSession): ByteArray {
val contentLength = session.headers["content-length"]!!.toInt()
val bytes = ByteArray(contentLength)
session.inputStream.read(bytes, 0, contentLength)
return bytes
}

fun newChunkedResponse(
data: ByteArray?,
mimeType: String = "application/binary",
Expand Down

0 comments on commit 4daffbe

Please sign in to comment.