записал с помощи byte[] bytes = input.readAllBytes(); output.write(bytes[i]);