INNER CODE UNIT · C++
read
OxygenCobalt/Auxio · musikr/src/main/cpp/JInputStream.cpp:68
jint read = env->CallIntMethod(jInputStream, jInputStreamReadBlockMethod,
*byteBuffer);
return read;
}
TagLib::ByteVector JInputStream::readBlock(size_t length) {
// We have to invert the buffer allocation here
TagLib::ByteVector buf { static_cast<unsigned int>(length), 0 };
jint read = readBlockImpl(buf);
if (read >= 0) {
buf.resize(read);
return buf;
} else if (read == -1) {
buf.resize(0);
return buf;
} else {
throw std::runtime_error("Failed to read block, see logs");
}