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


Java ContentStreamBase.ByteArrayStream方法代码示例

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


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

示例1: readCommandFromIncomingStream

import org.apache.solr.common.util.ContentStreamBase; //导入方法依赖的package包/类
@Test
public void readCommandFromIncomingStream() throws Exception {
	final String command = randomString();
	final ContentStream stream = new ContentStreamBase.ByteArrayStream(command.getBytes(), randomString());
	
	assertEquals(command.trim(), F.readCommandFromIncomingStream(stream).trim());
}
 
开发者ID:spaziocodice,项目名称:SolRDF,代码行数:8,代码来源:FTestCase.java

示例2: readCommandFromIncomingEmptyStream

import org.apache.solr.common.util.ContentStreamBase; //导入方法依赖的package包/类
@Test
public void readCommandFromIncomingEmptyStream() throws Exception {
	final String command = "";
	final ContentStream stream = new ContentStreamBase.ByteArrayStream(command.getBytes(), randomString());
	
	assertEquals(command.trim(), F.readCommandFromIncomingStream(stream).trim());
}
 
开发者ID:spaziocodice,项目名称:SolRDF,代码行数:8,代码来源:FTestCase.java

示例3: showFromZooKeeper

import org.apache.solr.common.util.ContentStreamBase; //导入方法依赖的package包/类
private void showFromZooKeeper(SolrQueryRequest req, SolrQueryResponse rsp,
    CoreContainer coreContainer) throws KeeperException,
    InterruptedException, UnsupportedEncodingException {

  SolrZkClient zkClient = coreContainer.getZkController().getZkClient();

  String adminFile = getAdminFileFromZooKeeper(req, rsp, zkClient, hiddenFiles);

  if (adminFile == null) {
    return;
  }

  // Show a directory listing
  List<String> children = zkClient.getChildren(adminFile, null, true);
  if (children.size() > 0) {
    
    NamedList<SimpleOrderedMap<Object>> files = new SimpleOrderedMap<>();
    for (String f : children) {
      if (isHiddenFile(req, rsp, f, false, hiddenFiles)) {
        continue;
      }

      SimpleOrderedMap<Object> fileInfo = new SimpleOrderedMap<>();
      files.add(f, fileInfo);
      List<String> fchildren = zkClient.getChildren(adminFile + "/" + f, null, true);
      if (fchildren.size() > 0) {
        fileInfo.add("directory", true);
      } else {
        // TODO? content type
        fileInfo.add("size", f.length());
      }
      // TODO: ?
      // fileInfo.add( "modified", new Date( f.lastModified() ) );
    }
    rsp.add("files", files);
  } else {
    // Include the file contents
    // The file logic depends on RawResponseWriter, so force its use.
    ModifiableSolrParams params = new ModifiableSolrParams(req.getParams());
    params.set(CommonParams.WT, "raw");
    req.setParams(params);
    ContentStreamBase content = new ContentStreamBase.ByteArrayStream(zkClient.getData(adminFile, null, null, true), adminFile);
    content.setContentType(req.getParams().get(USE_CONTENT_TYPE));
    
    rsp.add(RawResponseWriter.CONTENT, content);
  }
  rsp.setHttpCaching(false);
}
 
开发者ID:europeana,项目名称:search,代码行数:49,代码来源:ShowFileRequestHandler.java

示例4: showFromZooKeeper

import org.apache.solr.common.util.ContentStreamBase; //导入方法依赖的package包/类
private void showFromZooKeeper(SolrQueryRequest req, SolrQueryResponse rsp,
    CoreContainer coreContainer) throws KeeperException,
    InterruptedException, UnsupportedEncodingException {

  SolrZkClient zkClient = coreContainer.getZkController().getZkClient();

  String adminFile = getAdminFileFromZooKeeper(req, rsp, zkClient, hiddenFiles);

  if (adminFile == null) {
    return;
  }

  // Show a directory listing
  List<String> children = zkClient.getChildren(adminFile, null, true);
  if (children.size() > 0) {
    
    NamedList<SimpleOrderedMap<Object>> files = new SimpleOrderedMap<SimpleOrderedMap<Object>>();
    for (String f : children) {
      if (isHiddenFile(req, rsp, f, false, hiddenFiles)) {
        continue;
      }

      SimpleOrderedMap<Object> fileInfo = new SimpleOrderedMap<Object>();
      files.add(f, fileInfo);
      List<String> fchildren = zkClient.getChildren(adminFile + "/" + f, null, true);
      if (fchildren.size() > 0) {
        fileInfo.add("directory", true);
      } else {
        // TODO? content type
        fileInfo.add("size", f.length());
      }
      // TODO: ?
      // fileInfo.add( "modified", new Date( f.lastModified() ) );
    }
    rsp.add("files", files);
  } else {
    // Include the file contents
    // The file logic depends on RawResponseWriter, so force its use.
    ModifiableSolrParams params = new ModifiableSolrParams(req.getParams());
    params.set(CommonParams.WT, "raw");
    req.setParams(params);
    ContentStreamBase content = new ContentStreamBase.ByteArrayStream(zkClient.getData(adminFile, null, null, true), adminFile);
    content.setContentType(req.getParams().get(USE_CONTENT_TYPE));
    
    rsp.add(RawResponseWriter.CONTENT, content);
  }
  rsp.setHttpCaching(false);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:49,代码来源:ShowFileRequestHandler.java


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