public abstract class HttpUtils extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CONNECT_TIMEOUT |
static int |
DEFAULT_POST_BUFFER_SIZE
Default buffer size for reading data.
|
Constructor and Description |
---|
HttpUtils() |
Modifier and Type | Method and Description |
---|---|
static InputStream |
post(URL url,
InputStream dataStream)
Post a given
InputStream s data to a URL. |
static InputStream |
post(URL url,
InputStream dataStream,
String username,
String password)
Post a given
InputStream s data to a URL using BASIC
authentication and the given username and password. |
static InputStream |
post(URL url,
InputStream dataStream,
String username,
String password,
int bufSize,
int timeout)
Post a given
InputStream s data to a URL using BASIC
authentication, the given username and password, and a buffer size. |
static InputStream |
post(URL url,
Reader dataReader,
String username,
String password,
int bufSize,
int timeout)
Post a given
Reader s data to a URL using BASIC
authentication, the given username and password, and a buffer size. |
public static final int DEFAULT_POST_BUFFER_SIZE
public static final int DEFAULT_CONNECT_TIMEOUT
public static InputStream post(URL url, InputStream dataStream) throws IOException
InputStream
s data to a URL.url
- the URL
to post todataStream
- an input stream containing the data to sendInputStream
that the programmer can read from
to get the HTTP server's response.IOException
- if any.public static InputStream post(URL url, InputStream dataStream, String username, String password) throws IOException
InputStream
s data to a URL using BASIC
authentication and the given username and password.url
- the URL
to post todataStream
- an input stream containing the data to sendusername
- the username to use in the BASIC authenticationpassword
- the password to use in the BASIC authenticationInputStream
that the programmer can read from
to get the HTTP server's response.IOException
- if any.public static InputStream post(URL url, InputStream dataStream, String username, String password, int bufSize, int timeout) throws IOException
InputStream
s data to a URL using BASIC
authentication, the given username and password, and a buffer size.url
- the URL
to post todataStream
- an input stream containing the data to sendusername
- the username to use in the BASIC authenticationpassword
- the password to use in the BASIC authenticationbufSize
- the size of the buffer to read from dataStream
and write to the HTTP serverInputStream
that the programmer can read from
to get the HTTP server's response.IOException
- if any.public static InputStream post(URL url, Reader dataReader, String username, String password, int bufSize, int timeout) throws IOException
Reader
s data to a URL using BASIC
authentication, the given username and password, and a buffer size.url
- the URL
to post todataReader
- an input reader containing the data to sendusername
- the username to use in the BASIC authenticationpassword
- the password to use in the BASIC authenticationbufSize
- the size of the buffer to read from dataStream
and write to the HTTP serverInputStream
that the programmer can read from
to get the HTTP server's response.IOException
- if any.Copyright © 2021. All rights reserved.