Skip to content

Commit dc398c8

Browse files
committed
Add Kdoc to the image utility
1 parent 5c59a53 commit dc398c8

File tree

1 file changed

+13
-1
lines changed
  • kotlin/services/bedrock-runtime/src/main/kotlin/com/example/bedrockruntime/libs

1 file changed

+13
-1
lines changed

kotlin/services/bedrock-runtime/src/main/kotlin/com/example/bedrockruntime/libs/ImageTools.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,19 @@ import javax.swing.ImageIcon
1010
import javax.swing.JFrame
1111
import javax.swing.JLabel
1212

13+
/**
14+
* Utility object for handling image-related operations.
15+
*/
1316
object ImageTools {
17+
/**
18+
* Displays a byte array as an image in a new window.
19+
*
20+
* Creates a new JFrame window that displays the image represented by the provided byte array.
21+
* The window will close the application when closed (EXIT_ON_CLOSE).
22+
*
23+
* @param imageData The image data as a byte array
24+
* @throws RuntimeException if there is an error reading the image data
25+
*/
1426
fun displayImage(imageData: ByteArray) {
1527
try {
1628
val image = ImageIO.read(ByteArrayInputStream(imageData))
@@ -24,4 +36,4 @@ object ImageTools {
2436
throw RuntimeException(e)
2537
}
2638
}
27-
}
39+
}

0 commit comments

Comments
 (0)