You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
779 B
Java

package org.xbib.gradle.plugin.shadow.internal;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* This class was moved to java because groovy compiler reports "no such property: count"
*/
public class ServiceStream extends ByteArrayOutputStream {
public ServiceStream() {
super(1024);
}
public void append(InputStream is) throws IOException {
if (count > 0 && buf[count - 1] != '\n' && buf[count - 1] != '\r') {
byte[] newline = new byte[] {'\n'};
write(newline, 0, newline.length);
}
is.transferTo(this);
}
public InputStream toInputStream() {
return new ByteArrayInputStream(buf, 0, count);
}
}