mirror of
https://github.com/tursom/TursomServer.git
synced 2025-02-01 23:30:24 +08:00
update
This commit is contained in:
parent
7a90928246
commit
d86018ea4d
@ -12,6 +12,8 @@ class ThreadLocalSimpleDateFormat(
|
||||
fun format(date: Date) = get().format(date)
|
||||
fun parse(date: String) = get().parse(date)
|
||||
|
||||
fun now() = format(System.currentTimeMillis())
|
||||
|
||||
companion object {
|
||||
val iso8601 = ThreadLocalSimpleDateFormat("YYYY-MM-dd'T'HH:mm:ssZZ")
|
||||
val standard = ThreadLocalSimpleDateFormat("YYYY-MM-dd HH:mm:ss")
|
||||
|
@ -205,11 +205,12 @@ interface ByteBuffer : Closeable {
|
||||
array.forEachIndex(index, index + size - 1, this::put)
|
||||
}
|
||||
|
||||
fun put(inputStream: InputStream) {
|
||||
if (hasArray) {
|
||||
fun put(inputStream: InputStream): Int {
|
||||
return if (hasArray) {
|
||||
val read = inputStream.read(array, writeOffset, writeable)
|
||||
if (read < 0) throw IOException("stream closed")
|
||||
if (read < 0) throw IOException("stream closed")
|
||||
writePosition += read
|
||||
read
|
||||
} else {
|
||||
val buffer = ByteArray(10 * 1024)
|
||||
val read = inputStream.read(buffer)
|
||||
|
@ -6,7 +6,7 @@ import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
/**
|
||||
* 可自动申请新内存空间的内存池
|
||||
* 线程安全
|
||||
* 线程安全依赖于poolFactory提供的内存池的线程安全性
|
||||
*/
|
||||
class ExpandableMemoryPool(
|
||||
val maxPoolCount: Int = -1,
|
||||
|
Loading…
Reference in New Issue
Block a user