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