Skip to content

Commit

Permalink
Code Optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
“v_kkhuang” committed Dec 16, 2024
1 parent 588fa0d commit 804adfa
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,21 @@ object IOHelp {
writer.addRecord(ioRecord)
writer.toString()
} else if (method.params.length == 3) {
val parm1 = BigDecimal(method.params(1).toString).intValue()
val parm2 = BigDecimal(method.params(2).toString).intValue()
if (parm1 > 0) {
inputStream.skip(parm1)
}
val position =
if (method.params(1).toString.toDouble.toInt < 0) {
0
} else {
method.params(1).toString.toDouble.toInt
}
val fetchSize =
if (parm2 > maxPageSize) {
if (method.params(2).toString.toDouble.toInt > maxPageSize) {
maxPageSize.toInt
} else {
parm2
method.params(2).toString.toDouble.toInt
}
if (position > 0) {
inputStream.skip(position)
}
val bytes = new Array[Byte](fetchSize)
val len = StorageUtils.readBytes(inputStream, bytes, fetchSize)
val ioMetaData = new IOMetaData(0, len)
Expand Down

0 comments on commit 804adfa

Please sign in to comment.