Похожие чаты

Public byte[] readVideo(String filePath, int start, int end) throws IOException

{
Path path = Paths.get(filePath);
try (RandomAccessFile file = new RandomAccessFile(path.toFile(), "r")) {
int bufferSize = 5 * 1024 * 1024; // 10 mb
byte[] buffer = new byte[bufferSize];
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
int bytesRead;
int totalBytes = start;
while ((bytesRead = file.read(buffer)) != -1 && totalBytes < end) {
outputStream.write(buffer, 0, bytesRead);
totalBytes += bytesRead;
}
outputStream.flush();
logger.info("output stream::: " + outputStream.toByteArray());
return outputStream.toByteArray();
}
}

Do you mean like this?

1 ответов

6 просмотров

You can't just set totalBytes equal to start

Похожие вопросы

Обсуждают сегодня

30 BCH videos in Hausa Language successfully delivered. In December 2023, I created a Flipstarter to produce Bitcoin Cash videos in the Hausa language for greater outreach an...
Munnir
5
читать файл максимально быстро? странный вопрос))
zamtmn
53
братва! где куличи брать?
Alöscha
25
тоесть, указав return eax, сгенерируется никому ненужная инструкция mov eax,eax ?
Aiwan \ (•◡•) / _bot
24
Посоветуйте пожалуйста аудио плеер для библиотеки mp3- FLAC на компьютере. На Винде пользовался Aimp, в том числе для конвертации. Много нужных команд было прямо в контекст...
Виктор Кузнецов
31
Is FXTL another frax ecosystem token? Why need fxtl when there is already fxs? Why cant I find a straight answer for this? Maybe thats why people think its all so complicated
MBD Tan
11
Hi guys , do we have update on voting?
HB
16
How Much Btc Falling Down ?
Suriya
22
Hi guys ! Anvil is out ! Time for me to stake on capacity. Does someone has a clear tutorial ? I’m thinking about buying a ledger. Is that really possible to stake directl...
Mister Grega
17
я имею в виду официально интегрированный в телегу? в том плане что не сливает переписку с пользователем?
Andrey
9
Карта сайта