String (@NotNull String initial, final int i, boolean shiftEmptyLines) { StringBuilder result = new StringBuilder(initial.length()); List<byte[]> lines; try { LineReader reader = new LineReader(new ByteArrayInputStream(initial.getBytes(StandardCharsets.UTF_8))); lines = reader.readLines(); } catch (IOException e) { throw new RuntimeException(e); } boolean first = true; for (byte[] line : lines) { if (!first) result.append('\n'); if (line.length > 0 || shiftEmptyLines) { StringUtil.repeatSymbol(result, ' ', i); } result.append(new String(line, StandardCharsets.UTF_8)); first = false; } return result.toString(); }