in gflog-core/src/main/java/com/epam/deltix/gflog/core/LogConfigFactory.java [234:258]
private static InputStream substitute(final InputStream stream, final Properties properties) throws Exception {
byte[] array = new byte[Math.max(stream.available() + 1, 4096)];
int length = 0;
while (true) {
final int read = stream.read(array, length, array.length - length);
if (read < 0) {
break;
}
length += read;
if (length == array.length) {
array = Arrays.copyOf(array, length << 1);
}
}
final String original = new String(array, 0, length, StandardCharsets.UTF_8);
final String substitution = PropertyUtil.substitute(original, properties);
return original.equals(substitution) ?
new ByteArrayInputStream(array, 0, length) :
new ByteArrayInputStream(substitution.getBytes(StandardCharsets.UTF_8));
}