fix IOUtils import and usage

This commit is contained in:
josch 2011-02-14 03:36:24 +01:00
parent c321bf2084
commit 3b9bf6c688
2 changed files with 6 additions and 2 deletions

View file

@ -11,6 +11,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileInputStream;
import de.unibremen.informatik.hets.common.io.IOUtils;
public class HttpPostMultipart {
URLConnection connection;
OutputStream os = null;
@ -51,7 +53,7 @@ public class HttpPostMultipart {
type = "application/octet-stream";
write("Content-Type: " + type + "\r\n");
write("\r\n");
pipe(new FileInputStream((File)object), os);
IOUtils.copy(new FileInputStream((File)object), os);
} else {
write("\r\n");
write("\r\n");

View file

@ -11,6 +11,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileInputStream;
import de.unibremen.informatik.hets.common.io.IOUtils;
public class HttpPostUrlencoded {
URLConnection connection;
OutputStream os = null;
@ -38,7 +40,7 @@ public class HttpPostUrlencoded {
write(name + "=");
if (object instanceof File) {
write(URLEncoder.encode(InputStreamToString(new FileInputStream((File)object)), "UTF-8"));
write(URLEncoder.encode(IOUtils.getString(new FileInputStream((File)object)), "UTF-8"));
} else {
write(object.toString());
}