This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import assertk.assertThat | |
| import assertk.assertions.isEqualTo | |
| import kotlin.test.Test | |
| import kotlinx.coroutines.coroutineScope | |
| import kotlinx.coroutines.launch | |
| import kotlinx.coroutines.runBlocking | |
| class SuspendReturnTest { | |
| @Test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.squareup.wire.samples | |
| import com.squareup.wire.Message | |
| import com.squareup.wire.ProtoAdapter | |
| import com.squareup.wire.ProtoReader32 | |
| import com.squareup.wire.ProtoWriter | |
| import com.squareup.wire.forEachTag | |
| import okio.Buffer | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.awt.Rectangle | |
| import java.io.Closeable | |
| import java.io.IOException | |
| import java.util.zip.CRC32 | |
| import okio.Buffer | |
| import okio.BufferedSink | |
| import okio.BufferedSource | |
| import okio.ByteString | |
| import okio.ByteString.Companion.encodeUtf8 | |
| import okio.ByteString.Companion.toByteString |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.BufferedReader; | |
| import java.io.File; | |
| import java.io.FileOutputStream; | |
| import java.io.InputStream; | |
| import java.io.InputStreamReader; | |
| import java.net.URL; | |
| import java.net.URLClassLoader; | |
| import java.util.jar.JarOutputStream; | |
| import java.util.zip.ZipEntry; | |
| import static java.nio.charset.StandardCharsets.UTF_8; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| fun closeAJarFileWhileSomebodyIsReadingIt() { | |
| val someJarResource = this::class.java.classLoader.getResource("LICENSE-junit.txt")!! | |
| val connectionA = someJarResource.openConnection() | |
| val sourceA = connectionA.getInputStream().source().buffer() | |
| val connectionB = someJarResource.openConnection() | |
| val sourceB = connectionB.getInputStream().source().buffer() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright (C) 2021 Square, Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import okio.buffer | |
| import okio.source | |
| /** | |
| * Converts a Kotlin file with `backtick method names` to camelCaseMethodNames. | |
| */ | |
| fun main() { | |
| val source = System.`in`.source().buffer() | |
| while (true) { | |
| val line = source.readUtf8Line() ?: break |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public final long readVarint64() throws IOException { | |
| if (this.state != 0 && this.state != 2) { | |
| throw (Throwable)(new ProtocolException("Expected VARINT or LENGTH_DELIMITED but was " + this.state)); | |
| } else { | |
| int shift = 0; | |
| for(long result = 0L; shift < 64; shift += 7) { | |
| this.source.require(1L); | |
| int var10001 = this.pos++; | |
| byte b = this.source.readByte(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package okio.samples | |
| import okio.Buffer | |
| import okio.BufferedSink | |
| import okio.BufferedSource | |
| import okio.buffer | |
| import okio.source | |
| import java.io.File | |
| import java.util.concurrent.atomic.AtomicLong |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Copyright (C) 2020 Square, Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
NewerOlder