当前位置: 首页>>代码示例>>Java>>正文


Java IOUtils.toString方法代码示例

本文整理汇总了Java中org.apache.tika.io.IOUtils.toString方法的典型用法代码示例。如果您正苦于以下问题:Java IOUtils.toString方法的具体用法?Java IOUtils.toString怎么用?Java IOUtils.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tika.io.IOUtils的用法示例。


在下文中一共展示了IOUtils.toString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReferenceFiles

import org.apache.tika.io.IOUtils; //导入方法依赖的package包/类
public List<String> getReferenceFiles(Node rootNode,String path,String searchText) throws Exception{
	List<String> referenceFiles=new ArrayList<String>();
	List<String> files=getFiles(rootNode, path);
	for(String nodePath:files){
		InputStream inputStream=repositoryService.readFile(nodePath,null);
		try {
			String content = IOUtils.toString(inputStream);
			inputStream.close();
			boolean containPath=content.contains(path);
			boolean containText=content.contains(searchText);
			if(containPath && containText){
				referenceFiles.add(nodePath);
			}
		} catch (IOException e) {
			throw new RuleException(e);
		}
	}
	return referenceFiles;
}
 
开发者ID:youseries,项目名称:urule,代码行数:20,代码来源:RepositoryRefactor.java

示例2: testPolicyCreateByPost

import org.apache.tika.io.IOUtils; //导入方法依赖的package包/类
@Test
public void testPolicyCreateByPost() throws Exception {
    final HttpPost objMethod = HttpPostObjMethod(POLICY_RESOURCE);
    final StringEntity input = new StringEntity(MIME_KEY + " " + MIME + " " + STORE,
                                          "UTF-8");
    input.setContentType(APPLICATION_FORM_URLENCODED);
    objMethod.setEntity(input);
    final HttpResponse response = execute(objMethod);

    final String body = IOUtils.toString(response.getEntity().getContent());
    assertEquals(body, 201, response.getStatusLine().getStatusCode());

    policyKeys.add(MIME_KEY);

    final Header[] headers = response.getHeaders("Location");
    assertNotNull(headers);
    assertEquals(1, headers.length);
    assertEquals(objMethod.getURI()
                         .toString()
                         .replace(POLICY_RESOURCE, MIME_KEY),
                 headers[0].getValue());
}
 
开发者ID:fcrepo4-labs,项目名称:fcrepo-storage-policy,代码行数:23,代码来源:FedoraStoragePolicyIT.java

示例3: testGetStoragePolicy

import org.apache.tika.io.IOUtils; //导入方法依赖的package包/类
@Test
public void testGetStoragePolicy() throws Exception {
    // Test no policy
    final HttpGet getMethod0 = HttpGetObjMethod(MIME_KEY);
    final HttpResponse response0 = execute(getMethod0);
    assertNotNull(response0);
    assertEquals(IOUtils.toString(response0.getEntity().getContent()),
                 404,
                 response0.getStatusLine().getStatusCode());

    // Add a policy
    testPolicyCreateByPost();

    // Test Get Storage Policy
    final HttpGet getMethod1 = HttpGetObjMethod(MIME_KEY);
    final HttpResponse response1 = execute(getMethod1);
    assertNotNull(response1);

    final String body = IOUtils.toString(response1.getEntity().getContent());
    assertEquals(body, 200, response1.getStatusLine().getStatusCode());
    assertEquals(MIME + ":" + STORE, body);
}
 
开发者ID:fcrepo4-labs,项目名称:fcrepo-storage-policy,代码行数:23,代码来源:FedoraStoragePolicyIT.java

示例4: testGetStoragePolicies

import org.apache.tika.io.IOUtils; //导入方法依赖的package包/类
@Test
public void testGetStoragePolicies() throws Exception {
    // Add a policy
    testPolicyCreateByPost();

    // Test Get Storage Policy
    final HttpGet getMethod1 = HttpGetObjMethod(POLICY_RESOURCE);
    final HttpResponse response1 = execute(getMethod1);
    assertNotNull(response1);

    final String body = IOUtils.toString(response1.getEntity().getContent());
    assertEquals(body, 200, response1.getStatusLine().getStatusCode());

    final StoragePolicy policy = new MimeTypeStoragePolicy(MIME, STORE);
    assertTrue("Didn't find our policy in policies!", body.contains(policy.toString()));
}
 
开发者ID:fcrepo4-labs,项目名称:fcrepo-storage-policy,代码行数:17,代码来源:FedoraStoragePolicyIT.java

示例5: testGetContent

import org.apache.tika.io.IOUtils; //导入方法依赖的package包/类
@Test
public void testGetContent() throws RepositoryException, IOException {
    final String expected = "asdf";
    getContentNodeMock(mockContent, expected);
    when(mockDsNode.getNode(JCR_CONTENT)).thenReturn(mockContent);
    final String actual = IOUtils.toString(testObj.getContent());
    assertEquals(expected, actual);
    verify(mockContent).getProperty(JCR_DATA);
}
 
开发者ID:fcrepo4,项目名称:fcrepo4,代码行数:10,代码来源:FedoraBinaryImplTest.java

示例6: testToInputStream

import org.apache.tika.io.IOUtils; //导入方法依赖的package包/类
@Test
public void testToInputStream() throws IOException {
	Observable<Buffer> buf = Observable.just(Buffer.buffer("text"));
	try (InputStream ins = RxUtil.toInputStream(buf, Vertx.vertx())) {
		String text = IOUtils.toString(ins);
		assertEquals("text", text);
	}
}
 
开发者ID:gentics,项目名称:mesh,代码行数:9,代码来源:RxUtilTest.java

示例7: consumeOutput

import org.apache.tika.io.IOUtils; //导入方法依赖的package包/类
@Override
public void consumeOutput(InputStream in) throws IOException {
    if (in == null) {
        return;
    }
    
    output = IOUtils.toString(in);
    
    if (latch != null) {
        latch.countDown();
    }
}
 
开发者ID:samini,项目名称:gort-public,代码行数:13,代码来源:ImageHelper.java

示例8: script

import org.apache.tika.io.IOUtils; //导入方法依赖的package包/类
private String script() {
    try {
        InputStream in = this.getClass().getResourceAsStream(SCRIPT_NAME);
        if(in == null) {
            throw new RuntimeException(String.format("resource not found %s", SCRIPT_NAME));
        }
        return IOUtils.toString(in);
    } catch(IOException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:12,代码来源:AorraSvgGraphics2D.java


注:本文中的org.apache.tika.io.IOUtils.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。