Код: Выделить всё
byte[] buffer = new byte[1024];
int i = in.read(buffer, 0, 1024); //"in" is the input stream
String line = new String(buffer, 0, i);
System.out.println(line);
Код: Выделить всё
InputStreamReader reader = new InputStreamReader(in, StandardCharsets.UTF_8);
reader.read(); //this call never returns...
Оба приведенных выше блока кода находятся внутри задачи исполнителя, возможно, это связано:
Код: Выделить всё
ExecutorService executor = Executors.newCachedThreadPool();
executor.submit(
() -> {
//Read from streams..
});
Почему может работать чтение необработанного входного потока а с помощью читателей нет?
Подробнее здесь: https://stackoverflow.com/questions/792 ... er-returns
Мобильная версия