public final class IOHelper extends Object
| Constructor and Description |
|---|
IOHelper() |
| Modifier and Type | Method and Description |
|---|---|
static Map<String,String> |
createBasicAuthenticationProperty(String username,
String password)
Create HTTP Basic credentials to be used in HTTP get or post methods.
|
static byte[] |
dropUTF8BOM(byte[] source)
Silently drop UTF8 BOM
|
static Document |
getDocumentFromURL(DocumentBuilder documentBuilder,
String url,
Map<String,String> requestProperties,
Class<?>... resourceAwareClasses) |
static InputStream |
httpGet(String httpurl,
Map<String,String>... requestProperties)
Simple http get imlementation.
|
static InputStream |
httpPost(String httpurl,
String data,
Map<String,String>... requestProperties)
Simple http post implementation.
|
static String |
inputStreamToString(InputStream inputStream,
String... optionalCharsetName) |
static boolean |
isResourceProtocol(String url) |
static Document |
loadDocument(XBProjector projector,
InputStream is) |
public static Map<String,String> createBasicAuthenticationProperty(String username, String password)
username - password - public static InputStream httpGet(String httpurl, Map<String,String>... requestProperties) throws IOException
createBasicAuthenticationProperty(java.lang.String, java.lang.String) to add authentication.httpurl - get urlrequestProperties - optional http header fields (key->value)IOExceptionpublic static InputStream httpPost(String httpurl, String data, Map<String,String>... requestProperties) throws IOException
createBasicAuthenticationProperty(java.lang.String, java.lang.String) to add authentication.httpurl - target urldata - String with content to postrequestProperties - optional http header fields (key->value)IOExceptionpublic static String inputStreamToString(InputStream inputStream, String... optionalCharsetName)
inputStream - optionalCharsetName - optional parameterpublic static byte[] dropUTF8BOM(byte[] source)
source - public static Document loadDocument(XBProjector projector, InputStream is)
projector - is - anonymous input streampublic static Document getDocumentFromURL(DocumentBuilder documentBuilder, String url, Map<String,String> requestProperties, Class<?>... resourceAwareClasses) throws IOException
documentBuilder - url - requestProperties - resourceAwareClasses - Try useing this classes to load resource with resource protocol.IOExceptionpublic static boolean isResourceProtocol(String url)
url - Copyright © 2012-12-21-2017. All Rights Reserved.