← Docs
kotlin-stdlib / kotlin.io.path / java.nio.file.Path / readBytes

readBytes

JVM
JRE7
1.5
fun Path . readBytes ( ) : ByteArray
(source)

Gets the entire content of this file as a byte array.

It's not recommended to use this function on huge files. It has an internal limitation of approximately 2 GB byte array size. For reading large files or files of unknown size, open an InputStream and read blocks sequentially.

Return the entire content of this file as a byte array.

Stay in touch:
  • Contributing to Kotlin
  • Releases
  • Press Kit
  • Security
  • Blog
  • Issue Tracker
  • Brand assets
  • Careers
Supported and developed by JetBrains .
Kotlin™ is protected under the Kotlin Foundation
and licensed under the Apache 2 license .