本文整理了Java中org.apache.cxf.helpers.IOUtils.toString()
方法的一些代码示例,展示了IOUtils.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.toString()
方法的具体详情如下:
包路径:org.apache.cxf.helpers.IOUtils
类名称:IOUtils
方法名:toString
暂无
代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws
ds = new ByteDataSource(IOUtils.toString(src.getReader()).getBytes(StandardCharsets.UTF_8),
ct);
代码示例来源:origin: apache/cxf
public static String toString(final InputStream input, String charset) throws IOException {
return toString(input, DEFAULT_BUFFER_SIZE, charset);
}
public static String toString(final InputStream input, int bufferSize)
代码示例来源:origin: apache/cxf
public static String readStringFromStream(InputStream in)
throws IOException {
return toString(in);
}
代码示例来源:origin: org.apache.cxf/cxf-core
public static String toString(final InputStream input, int bufferSize, String charset)
throws IOException {
int avail = input.available();
if (avail > bufferSize) {
bufferSize = avail;
}
Reader reader = charset == null ? new InputStreamReader(input, UTF8_CHARSET)
: new InputStreamReader(input, charset);
return toString(reader, bufferSize);
}
代码示例来源:origin: apache/cxf
public static String toString(final InputStream input, int bufferSize, String charset)
throws IOException {
int avail = input.available();
if (avail > bufferSize) {
bufferSize = avail;
}
Reader reader = charset == null ? new InputStreamReader(input, UTF8_CHARSET)
: new InputStreamReader(input, charset);
return toString(reader, bufferSize);
}
代码示例来源:origin: org.apache.cxf/cxf-api
public static String toString(final InputStream input, int bufferSize, String charset)
throws IOException {
int avail = input.available();
if (avail > bufferSize) {
bufferSize = avail;
}
Reader reader = charset == null ? new InputStreamReader(input, UTF8_CHARSET)
: new InputStreamReader(input, charset);
return toString(reader, bufferSize);
}
代码示例来源:origin: apache/cxf
private String getStringFromInputStream(InputStream in) throws Exception {
return IOUtils.toString(in);
}
}
代码示例来源:origin: apache/servicemix
public void getPerson(int id) throws Exception{
String url = PERSON_SERVICE_URL + "person/get/" + id;
System.out.println("\n### GET PERSON WITH ID " + id + " FROM URL " + url);
HttpURLConnection connection = connect(url);
connection.setDoInput(true);
InputStream stream = connection.getResponseCode() / 100 == 2 ?
connection.getInputStream() : connection.getErrorStream();
System.out.println("Status: " + connection.getResponseCode() + " " +
connection.getResponseMessage());
System.out.println(IOUtils.toString(stream));
}
代码示例来源:origin: apache/cxf
private String getStringFromInputStream(InputStream in) throws Exception {
return IOUtils.toString(in);
}
}
代码示例来源:origin: apache/cxf
@Test
public void testSchema() throws Exception {
URL url = new URL("http://localhost:" + PORT + "/service/TestService?wsdl");
String s = IOUtils.toString(url.openStream());
Assert.assertTrue(s, s.contains("application/octet-stream"));
}
代码示例来源:origin: apache/cxf
private Document loadWsdl(String serviceName) throws Exception {
HttpURLConnection connection = getHttpConnection("http://localhost:" + PORT + "/" + serviceName
+ "?wsdl");
InputStream is = connection.getInputStream();
String wsdlContents = IOUtils.toString(is);
// System.out.println(wsdlContents);
return StaxUtils.read(new StringReader(wsdlContents));
}
代码示例来源:origin: apache/cxf
@Test
public void testImportSchema() throws Exception {
String schemaURL = "http://localhost:" + PORT + "/schemaimport/sayHi" + "?xsd=sayhi/sayhi/sayhi-schema1.xsd";
URL url = new URL(schemaURL);
try (InputStream ins = url.openStream()) {
String output = IOUtils.toString(ins);
assertTrue(output.indexOf("sayHiArray") > -1);
} catch (Exception e) {
e.printStackTrace();
fail("Can not access the import schema");
}
}
代码示例来源:origin: apache/cxf
@Test
public void testImportWsdl() throws Exception {
String wsdlURL = "http://localhost:" + PORT + "/schemaimport/sayHi" + "?wsdl=sayhi/sayhi/a.wsdl";
URL url = new URL(wsdlURL);
try (InputStream ins = url.openStream()) {
String output = IOUtils.toString(ins);
assertTrue(output.indexOf("sayHiArray") > -1);
} catch (Exception e) {
e.printStackTrace();
fail("Can not access the import wsdl");
}
}
代码示例来源:origin: apache/cxf
@Test
public void testImportWsdl2() throws Exception {
String wsdlURL = "http://localhost:" + PORT + "/schemaimport/sayHi2" + "?wsdl=../sayhi/sayhi/a.wsdl";
URL url = new URL(wsdlURL);
try (InputStream ins = url.openStream()) {
String output = IOUtils.toString(ins);
assertTrue(output.indexOf("sayHiArray") > -1);
} catch (Exception e) {
e.printStackTrace();
fail("Can not access the import wsdl");
}
}
代码示例来源:origin: apache/cxf
@Test
public void testSchemaInclude() throws Exception {
String schemaURL = "http://localhost:" + PORT + "/schemainclude/service?xsd=d1/d1/test.xsd";
URL url = new URL(schemaURL);
try (InputStream ins = url.openStream()) {
String output = IOUtils.toString(ins);
assertTrue(output.indexOf("msg:RequestType") > -1);
assertTrue(output.indexOf("msg:SomeFeatureType") > -1);
} catch (Exception e) {
e.printStackTrace();
fail("Can not access the include schema");
}
}
代码示例来源:origin: apache/cxf
@Test
public void testAnotherSchemaImportl() throws Exception {
String schemaURL = "http://localhost:" + PORT + "/schemaimport/service" + "?xsd=schema1.xsd";
URL url = new URL(schemaURL);
try (InputStream ins = url.openStream()) {
String output = IOUtils.toString(ins);
assertTrue(output.indexOf("schemaimport/service?xsd=schema2.xsd") > -1);
assertTrue(output.indexOf("schemaimport/service?xsd=schema5.xsd") > -1);
} catch (Exception e) {
e.printStackTrace();
fail("Can not access the import wsdl");
}
}
代码示例来源:origin: apache/cxf
private String readUrl(String address) {
String content = null;
try {
URL url = new URL(address);
assertNotNull(url.getContent());
content = IOUtils.toString((InputStream) url.getContent());
} catch (IOException e) {
e.printStackTrace(System.err);
Assert.fail("Couldn't read URL: " + e.getMessage());
}
return content;
}
代码示例来源:origin: apache/cxf
@Test
public void testGetBookQueryGZIP() throws Exception {
String address = "http://localhost:" + PORT + "/bookstore/";
WebClient wc = WebClient.create(address);
wc.acceptEncoding("gzip,deflate");
wc.encoding("gzip");
InputStream r = wc.get(InputStream.class);
assertNotNull(r);
GZIPInputStream in = new GZIPInputStream(r);
String s = IOUtils.toString(in);
in.close();
assertTrue(s, s.contains("id>124"));
}
代码示例来源:origin: apache/cxf
@Test
public void testJaxWsMtomReply() throws Exception {
setupForTest(true);
DataHandlerBean dhBean = jaxwsClient.produceDataHandlerBean();
Assert.assertNotNull(dhBean);
String result = IOUtils.toString(dhBean.getDataHandler().getInputStream(), "utf-8");
Assert.assertEquals(MtomTestImpl.STRING_DATA, result);
}
代码示例来源:origin: apache/cxf
@Test
public void testMtomReply() throws Exception {
setupForTest(true);
DataHandlerBean dhBean = client.produceDataHandlerBean();
Assert.assertNotNull(dhBean);
String result = IOUtils.toString(dhBean.getDataHandler().getInputStream(), "utf-8");
Assert.assertEquals(MtomTestImpl.STRING_DATA, result);
}
内容来源于网络,如有侵权,请联系作者删除!