Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@

/**
* A resource processor that appends content for a resource, separated by a newline.
* The newline separator can be disabled with {@code <separator>false</separator>}.
*/
public class AppendingTransformer extends AbstractCompatibilityTransformer {
String resource;
boolean separator = true;

ByteArrayOutputStream data = new ByteArrayOutputStream();

Expand All @@ -47,7 +49,9 @@ public boolean canTransformResource(String r) {
public void processResource(String resource, InputStream is, List<Relocator> relocators, long time)
throws IOException {
IOUtil.copy(is, data);
data.write('\n');
if (separator || !data.toString().endsWith("\n")) {
data.write('\n');
}
if (time > this.time) {
this.time = time;
}
Expand Down