Created
October 16, 2020 06:42
-
-
Save anton0xf/e108e578086a4d36c580d96ea163ab45 to your computer and use it in GitHub Desktop.
OK task 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Handler { | |
public final int MAX_SIZE = 1_000_000_000; | |
private StringBuilder buf = new StringBuilder(MAX_SIZE); | |
public void put(char letter) { | |
buf.append(letter); | |
} | |
public void get(OutputStream outputStream) throws IOException { | |
for (int i = 0; i < buf.length(); i++) { | |
outputStream.write(buf.charAt(i)); | |
} | |
buf.setLength(0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Обработчик должен уметь накапливать (латинские) символы, а потом отдавать их.
Тут предполагается, что всё происходит синхронно, и что никто не будет пытаться загрузить больше, чем нужно.
Надо, по сути, придумать удачную сигнатуру. Задание немного кривое, т.к. не понятно, что от тебя хотят.