org.apache.solr.common.util.ContentStream.java 主要是获取文件,URL,字节数组,字符串等的数据流.主要方法又InputStream getStream()和 Reader getReader().

其实现类:org.apache.solr.common.util.ContentStreamBase.java为抽象类.以下有URLStream.java,FileStream.java,StringStream.java,ByteArrayStream.java四个实现类.分别针对URL,文件,字符串,字节数组.

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWcAAAE/CAIAAAAVB5VAAAAgAElEQVR4nO2d3W/b1sGHhRb7M9pibYD1JuqwuEWKAU7RpnabIoghFa5TTIniukubpYgNV7bbRYmlOYnTJZWcRUmcZJrnxI6RvrAr2/lS8wHEmO0CDLgVAZQVzbCmWKcVGNruphe94HvBr0PykOKhSZEWf8ZzIdGHh6Sk8+icI/LHCFflVymCICw9tFYQBOWB77sEQBiI+L4HjiGtIf55v9HjsUi0d9n/Ywfus5yKBu3NreSK6WSp4vduGFjd1vju+tLSQ2uXHlr73fUlD6xxPBaR/xLH5SV1+2DN9jZF1L+m1IznR1dXRhIR/Z9LuzGTjRLvl/QXm6y1oiNrjCQi0ewsyyoTU+nWQrq1kG6dWqxVGNZwHbKX4cYIZba3ifhsTcY1H7XJeDQ76701yH3Q7o+70I9uBS+X87WOxyLxERcPbTkVlQx7PBYhX0xxK66/qrO9TfY/EhNTqizKpfxAWXpgwyBBItDWSF3J/yTzcrSQTF3JG//r9rwG+XkiP3AkjWENs6NzvKsrWctla4wk5PpVfax8ty2ZjNvtJVVyxXxuQb8c1nCPzed6t198d/6zP55azG+/+O7mc726AoIgfH10TByhfH10zMQaSh812puNE/18te8qdyKIscBk3GREcDwm1qPrUS+novqesPjpPB6TBxczWaWI0kgs94Hy+dbXqVlFU220d1Lapdik1LOQt8JzpkdnWWGWrES3q8ZjsbkWr7XGbG8T0eGX9pM4av1Yw7hR8pvfKEfqKyy/nsupqLQnxj23/CxR9UQfXJB9DXWJOGAp5HMLkkEmpsSnlVwxLfZHJqbSydL8gFiyOF82rJ4szQ8UKEryhIBao+fy0fYL3R/xozKn2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ErkJggg==" alt="" />

接口:ContentStream.java

  1. package org.apache.solr.common.util;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5. import java.io.Reader;
  6.  
  7. /**
  8. *
  9. * @since solr 1.2
  10. */
  11. public interface ContentStream {
  12. String getName();
  13. String getSourceInfo();
  14. String getContentType();
  15.  
  16. /**
  17. * @return 数据流大小 或者 <code>null</code>
  18. */
  19. Long getSize(); //如果知道返回大小否则位null
  20.  
  21. /**
  22. * 获取一个打开的数据流,那么必须负责关闭它.可以考虑这样使用:
  23. * <pre>
  24. * InputStream stream = stream.getStream();
  25. * try {
  26. * // use the stream...
  27. * }
  28. * finally {
  29. * IOUtils.closeQuietly(stream);
  30. * }
  31. * </pre>
  32. *
  33. * 为了保证正在运行,只有在第一次时调用<code>getStream()</code> 或者 <code>getReader()</code>,
  34. * 其他调用的运行行为时不明确的.
  35. *
  36. * 注意: 在属性(name, contentType, etc)保证被赋值之前,必须调用<code>getStream()</code> 或者
  37. * <code>getReader()</code>.数据流只有在该方法调用时才可能懒加载.
  38. */
  39. InputStream getStream() throws IOException;
  40.  
  41. /**
  42. * 获取一个打开的数据流,那么必须负责关闭它.可以考虑这样使用:
  43. * <pre>
  44. * Reader reader = stream.getReader();
  45. * try {
  46. * // use the reader...
  47. * }
  48. * finally {
  49. * IOUtils.closeQuietly(reader);
  50. * }
  51. * </pre>
  52. *
  53. * 为了保证正在运行,只有在第一次时调用<code>getStream()</code> 或者 <code>getReader()</code>,
  54. * 其他调用的运行行为时不明确的.
  55. *
  56. * 注意: 在属性(name, contentType, etc)保证被赋值之前,必须调用<code>getStream()</code> 或者
  57. * <code>getReader()</code>.数据流只有在该方法调用时才可能懒加载.
  58. */
  59. Reader getReader() throws IOException;
  60. }

抽象类:ContentStreamBase.java 及其实现类URLStream.java,FileStream.java,StringStream.java,ByteArrayStream.java

  1. package org.apache.solr.common.util;
  2.  
  3. import java.io.ByteArrayInputStream;
  4. import java.io.File;
  5. import java.io.FileInputStream;
  6. import java.io.IOException;
  7. import java.io.InputStream;
  8. import java.io.InputStreamReader;
  9. import java.io.Reader;
  10. import java.io.StringReader;
  11. import java.net.URL;
  12. import java.net.URLConnection;
  13. import java.util.Locale;
  14.  
  15. /**
  16. * 三个ContentStream的具体实现 - 一个 File/URL/String
  17. *
  18. *
  19. * @since solr 1.2
  20. */
  21. public abstract class ContentStreamBase implements ContentStream
  22. {
  23. public static final String DEFAULT_CHARSET = "utf-8";
  24.  
  25. protected String name;
  26. protected String sourceInfo;
  27. protected String contentType;
  28. protected Long size;
  29.  
  30. //---------------------------------------------------------------------
  31. //---------------------------------------------------------------------
  32. /**
  33. * 从 内容类型字符串中得到字符编码设置,没有的话,返回null
  34. * @param contentType
  35. * @return
  36. */
  37. public static String getCharsetFromContentType( String contentType )
  38. {
  39. if( contentType != null ) {
  40. //获取contentType中"charset="的索引下标
  41. int idx = contentType.toLowerCase(Locale.ROOT).indexOf( "charset=" );
  42. if( idx > 0 ) {
  43. return contentType.substring( idx + "charset=".length() ).trim();
  44. }
  45. }
  46. return null;
  47. }
  48.  
  49. //------------------------------------------------------------------------
  50. //------------------------------------------------------------------------
  51.  
  52. /**
  53. * 根据<code>URL</code> 构造<code>ContentStream</code>
  54. *
  55. * 这里使用<code>URLConnection</code>来获得数据流的内容
  56. * @see URLConnection
  57. */
  58. public static class URLStream extends ContentStreamBase
  59. {
  60. private final URL url;
  61.  
  62. public URLStream( URL url ) {
  63. this.url = url;
  64. sourceInfo = "url";
  65. }
  66.  
  67. @Override
  68. public InputStream getStream() throws IOException {
  69. URLConnection conn = this.url.openConnection();
  70.  
  71. contentType = conn.getContentType();
  72. name = url.toExternalForm();
  73. size = new Long( conn.getContentLength() );
  74. return conn.getInputStream();
  75. }
  76. }
  77.  
  78. /**
  79. * 根据<code>File</code> 构造<code>ContentStream</code>
  80. */
  81. public static class FileStream extends ContentStreamBase
  82. {
  83. private final File file;
  84.  
  85. public FileStream( File f ) {
  86. file = f;
  87.  
  88. contentType = null; // ??
  89. name = file.getName();
  90. size = file.length();
  91. sourceInfo = file.toURI().toString();
  92. }
  93.  
  94. @Override
  95. public String getContentType() {
  96. if(contentType==null) {
  97. InputStream stream = null;
  98. try {
  99. stream = new FileInputStream(file);
  100. char first = (char)stream.read();
  101. if(first == '<') {
  102. return "application/xml";
  103. }
  104. if(first == '{') {
  105. return "application/json";
  106. }
  107. } catch(Exception ex) {
  108. } finally {
  109. if (stream != null) try {
  110. stream.close();
  111. } catch (IOException ioe) {}
  112. }
  113. }
  114. return contentType;
  115. }
  116.  
  117. @Override
  118. public InputStream getStream() throws IOException {
  119. return new FileInputStream( file );
  120. }
  121. }
  122.  
  123. /**
  124. * 根据<code>String</code> 构造<code>ContentStream</code>
  125. */
  126. public static class StringStream extends ContentStreamBase
  127. {
  128. private final String str;
  129.  
  130. public StringStream( String str ) {
  131. this.str = str;
  132.  
  133. contentType = null;
  134. name = null;
  135. size = new Long( str.length() );
  136. sourceInfo = "string";
  137. }
  138.  
  139. @Override
  140. public String getContentType() {
  141. if(contentType==null && str.length() > 0) {
  142. char first = str.charAt(0);
  143. if(first == '<') {
  144. return "application/xml";
  145. }
  146. if(first == '{') {
  147. return "application/json";
  148. }
  149. // find a comma? for CSV?
  150. }
  151. return contentType;
  152. }
  153.  
  154. @Override
  155. public InputStream getStream() throws IOException {
  156. return new ByteArrayInputStream( str.getBytes(DEFAULT_CHARSET) );
  157. }
  158.  
  159. /**
  160. * 如果contentType中没有定义charset编码,则使用StringReader
  161. */
  162. @Override
  163. public Reader getReader() throws IOException {
  164. String charset = getCharsetFromContentType( contentType );
  165. return charset == null
  166. ? new StringReader( str )
  167. : new InputStreamReader( getStream(), charset );
  168. }
  169. }
  170.  
  171. /**
  172. * 基本的reader 实现. 如果contentType声明了一个charset,
  173. * 则使用charset中的编码,否则使用utf-8.
  174. */
  175. @Override
  176. public Reader getReader() throws IOException {
  177. String charset = getCharsetFromContentType( getContentType() );
  178. return charset == null
  179. ? new InputStreamReader( getStream(), DEFAULT_CHARSET )
  180. : new InputStreamReader( getStream(), charset );
  181. }
  182.  
  183. //------------------------------------------------------------------
  184. // Getters / Setters for overrideable attributes
  185. //------------------------------------------------------------------
  186.  
  187. @Override
  188. public String getContentType() {
  189. return contentType;
  190. }
  191.  
  192. public void setContentType(String contentType) {
  193. this.contentType = contentType;
  194. }
  195.  
  196. @Override
  197. public String getName() {
  198. return name;
  199. }
  200.  
  201. public void setName(String name) {
  202. this.name = name;
  203. }
  204.  
  205. @Override
  206. public Long getSize() {
  207. return size;
  208. }
  209.  
  210. public void setSize(Long size) {
  211. this.size = size;
  212. }
  213.  
  214. @Override
  215. public String getSourceInfo() {
  216. return sourceInfo;
  217. }
  218.  
  219. public void setSourceInfo(String sourceInfo) {
  220. this.sourceInfo = sourceInfo;
  221. }
  222.  
  223. /**
  224. * 根据<code>File</code> 构造<code>ContentStream</code>
  225. */
  226. public static class ByteArrayStream extends ContentStreamBase
  227. {
  228. private final byte[] bytes;
  229.  
  230. public ByteArrayStream( byte[] bytes, String source ) {
  231. this.bytes = bytes;
  232.  
  233. this.contentType = null;
  234. name = source;
  235. size = new Long(bytes.length);
  236. sourceInfo = source;
  237. }
  238.  
  239. @Override
  240. public InputStream getStream() throws IOException {
  241. return new ByteArrayInputStream( bytes );
  242. }
  243. }
  244. }

org.apache.solr.common.util.ContentStream.java及其实现类的更多相关文章

  1. solrj:org.apache.solr.common.util.NamedList.java

    package org.apache.solr.common.util; import java.io.Serializable; import java.util.ArrayList; import ...

  2. java.lang.NoClassDefFoundError: org/apache/solr/common/params/SolrParams

    启动tomcat服务,报错误java.lang.NoClassDefFoundError: org/apache/solr/common/params/SolrParams [2016-03-10 2 ...

  3. mavne install 报错org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException

    maven install 报错 org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.Invoc ...

  4. solr启动时报错org.apache.solr.common.SolrException: undefined field text的解决办法

    solr启动时报错org.apache.solr.common.SolrException: undefined field text的解决办法 原创 2015年08月21日 20:47:40 标签: ...

  5. Solr6.4.2异常:org.apache.solr.common.SolrException: Error opening new searcher

    版权声明:本文为博主原创文章,转载请附上原文出处链接和本声明. 原文链接:https://www.cnblogs.com/chenghu/p/13840021.html Solr版本6.4.2 启动S ...

  6. solr error logs org.apache.solr.common.SolrException: ERROR: [doc=17] unknown field alias

    在solr中 添加新的索引词语时,报如标题所示错误,指定是插入的字段没有在solr索引字段里 可以修改 solr安装目录/solr/conf 目录下的 schema.xml 在此xml文件内加入所需字 ...

  7. Apache Solr采用Java开发、基于Lucene的全文搜索服务器

    http://docs.spring.io/spring-data/solr/ 首先介绍一下solr: Apache Solr (读音: SOLer) 是一个开源.高性能.采用Java开发.基于Luc ...

  8. 关于ActiveMQ+Zookeeper做集群时,解决启动报错:java.io.IOException: com/google/common/util/concurrent/internal/InternalFutureFailureAccess

    这个问题我也是无意间碰到的,之前一直是使用单机的ActiveMQ,所以也没这个问题,但是做集群时碰到这个问题,问题是这样子出现的: 首先,我准备了三台虚拟机,然后使用 Replicated Level ...

  9. solr环境搭建及java小demo

    一配置solr环境 1.下载solr 2.配置solr(最好单独分离出一个tomcat,一台机器启动多个tomcat参见:http://www.cnblogs.com/lxlwellaccessful ...

随机推荐

  1. 如何让Java和C++接口互相调用:JNI使用指南

    如何让Java和C++接口互相调用:JNI使用指南 转自:http://cn.cocos2d-x.org/article/index?type=cocos2d-x&url=/doc/cocos ...

  2. Working with Other Node Types II

    [Working with Other Node Types II] An SKCropNode object does not directly render content, like a spr ...

  3. OpenGL复习要点

    [OpenGL要点复习] 1.和像素有关的信息(例如像素的颜色)组织成位平面 (bitplane)的形式,位平面又可以组织成帧缓冲区(framebuffer)的形式.位平面是一块内存区域,保存了屏幕上 ...

  4. V7承保 bug代码

    v7 bug1

  5. OSPF ProcessID(进程号)详解

    一.OSPF ProcessID本地有效         首先明确一下,OSPF ProcessID,范围为1-65535,用于在路由器本地标识OSPF进程. 看上图,R1使用进程号10创建了一个OS ...

  6. 创建类模式(五):单例(Singleton)

    定义 确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例. 单例模式一般情况下通过使用private的构造函数确保了在一个应用中只产生一个实例,并且是自行实例化. 和静态变量的区别 虽然 ...

  7. OC三种方法实现定时器

    在软件开发过程中,我们常常需要在某个时间后执行某个方法,或者是按照某个周期一直执行某个方法.在这个时候,我们就需要用到定时器. 在iOS中有很多方法完成定时器的任务,例如 NSTimer.CADisp ...

  8. 实现带查询功能的Combox控件

    前言 ComBox 还可以实现查询功能,通过设置 ComBox 控件的 AutoCompleteSource 属性和 AutoCompleteMode 属性,可以实现从 Combox 控件中查询已存在 ...

  9. Android中全局Application的onCreate多次调用问题

    String processName = OsUtils.getProcessName(this, android.os.Process.myPid()); if (processName != nu ...

  10. UDT: Breaking the Data Transfer Bottleneck

    http://udt.sourceforge.net/ DT is a reliable UDP based application level data transport protocol for ...