New J2K: Fix existing test data
This commit is contained in:
committed by
Ilya Kirillov
parent
5236858c20
commit
f752796408
@@ -0,0 +1,13 @@
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
|
||||
class C {
|
||||
@Throws(IOException::class)
|
||||
internal fun foo() {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
// reading something
|
||||
val c = stream.read()
|
||||
println(c)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.IOException
|
||||
|
||||
class C {
|
||||
@Throws(IOException::class)
|
||||
internal fun foo() {
|
||||
ByteArrayInputStream(ByteArray(10)).use { input ->
|
||||
ByteArrayOutputStream().use { output ->
|
||||
output.write(input.read())
|
||||
output.write(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
|
||||
class C {
|
||||
@Throws(IOException::class)
|
||||
internal fun foo() {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream -> println(stream.read()) }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
|
||||
class C {
|
||||
internal fun foo() {
|
||||
try {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
// reading something
|
||||
val c = stream.read()
|
||||
println(c)
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
println(e)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
|
||||
class C {
|
||||
internal fun foo() {
|
||||
try {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
// reading something
|
||||
val c = stream.read()
|
||||
println(c)
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
println(e)
|
||||
} finally {
|
||||
println("Finally!")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
|
||||
class C {
|
||||
internal fun foo() {
|
||||
try {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
// reading something
|
||||
val c = stream.read()
|
||||
println(c)
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
println(e)
|
||||
} catch (e: Exception) {
|
||||
System.err.println(e)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
|
||||
class C {
|
||||
@Throws(IOException::class)
|
||||
internal fun foo() {
|
||||
try {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
// reading something
|
||||
val c = stream.read()
|
||||
println(c)
|
||||
}
|
||||
} finally {
|
||||
// dispose something else
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
|
||||
class C {
|
||||
internal fun foo(): Int {
|
||||
try {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
// reading something
|
||||
return stream.read()
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
println(e)
|
||||
return -1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
|
||||
internal interface I {
|
||||
@Throws(IOException::class)
|
||||
fun doIt(stream: InputStream?): Int
|
||||
}
|
||||
|
||||
class C {
|
||||
@Throws(IOException::class)
|
||||
internal fun foo() {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
bar(object : I {
|
||||
@Throws(IOException::class)
|
||||
override fun doIt(stream: InputStream): Int {
|
||||
return stream.available()
|
||||
}
|
||||
}, stream)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
internal fun bar(i: I, stream: InputStream?): Int {
|
||||
return i.doIt(stream)
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
|
||||
internal interface I {
|
||||
@Throws(IOException::class)
|
||||
fun doIt(stream: InputStream?): Int
|
||||
}
|
||||
|
||||
class C {
|
||||
@Throws(IOException::class)
|
||||
internal fun foo(): Int {
|
||||
ByteArrayInputStream(ByteArray(10)).use { stream ->
|
||||
return bar(object : I {
|
||||
@Throws(IOException::class)
|
||||
override fun doIt(stream: InputStream): Int {
|
||||
return stream.available()
|
||||
}
|
||||
}, stream)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
internal fun bar(i: I, stream: InputStream?): Int {
|
||||
return i.doIt(stream)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user