fix IOUtils import and usage
This commit is contained in:
parent
c321bf2084
commit
3b9bf6c688
2 changed files with 6 additions and 2 deletions
|
@ -11,6 +11,8 @@ import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
|
||||||
|
import de.unibremen.informatik.hets.common.io.IOUtils;
|
||||||
|
|
||||||
public class HttpPostMultipart {
|
public class HttpPostMultipart {
|
||||||
URLConnection connection;
|
URLConnection connection;
|
||||||
OutputStream os = null;
|
OutputStream os = null;
|
||||||
|
@ -51,7 +53,7 @@ public class HttpPostMultipart {
|
||||||
type = "application/octet-stream";
|
type = "application/octet-stream";
|
||||||
write("Content-Type: " + type + "\r\n");
|
write("Content-Type: " + type + "\r\n");
|
||||||
write("\r\n");
|
write("\r\n");
|
||||||
pipe(new FileInputStream((File)object), os);
|
IOUtils.copy(new FileInputStream((File)object), os);
|
||||||
} else {
|
} else {
|
||||||
write("\r\n");
|
write("\r\n");
|
||||||
write("\r\n");
|
write("\r\n");
|
||||||
|
|
|
@ -11,6 +11,8 @@ import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
|
||||||
|
import de.unibremen.informatik.hets.common.io.IOUtils;
|
||||||
|
|
||||||
public class HttpPostUrlencoded {
|
public class HttpPostUrlencoded {
|
||||||
URLConnection connection;
|
URLConnection connection;
|
||||||
OutputStream os = null;
|
OutputStream os = null;
|
||||||
|
@ -38,7 +40,7 @@ public class HttpPostUrlencoded {
|
||||||
|
|
||||||
write(name + "=");
|
write(name + "=");
|
||||||
if (object instanceof File) {
|
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 {
|
} else {
|
||||||
write(object.toString());
|
write(object.toString());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue