import java.io.IOException;
import java.io.InputStream;
+import be.nikiroo.utils.StringUtils;
+
/**
* This {@link InputStream} will change some of its content by replacing it with
* something else.
* the {@link String} to replace with
*/
public ReplaceInputStream(InputStream in, String from, String to) {
- this(in, StreamUtils.bytes(from), StreamUtils.bytes(to));
+ this(in, StringUtils.getBytes(from), StringUtils.getBytes(to));
}
/**
* the values to replace with
*/
public ReplaceInputStream(InputStream in, String[] froms, String[] tos) {
- this(in, StreamUtils.bytes(froms), StreamUtils.bytes(tos));
+ this(in, StreamUtils.getBytes(froms), StreamUtils.getBytes(tos));
}
/**
if (froms[i] != null && froms[i].length > 0
&& StreamUtils.startsWith(froms[i], source, spos, slen)) {
if (tos[i] != null && tos[i].length > 0) {
- System.arraycopy(tos[i], 0, buffer, off + spos,
+ System.arraycopy(tos[i], 0, buffer, off + count,
tos[i].length);
count += tos[i].length;
}
-
+
spos += froms[i].length;
replaced = true;
break;