ContentStreamBase content = new ContentStreamBase.FileStream( adminFile ); content.setContentType( req.getParams().get( USE_CONTENT_TYPE ) );
/** * If an charset is defined (by the contentType) use that, otherwise * use a file reader */ @Override public Reader getReader() throws IOException { String charset = getCharsetFromContentType( contentType ); return charset == null ? new FileReader( file ) : new InputStreamReader( getStream(), charset ); } }
ContentStreamBase stream = new ContentStreamBase.FileStream( new File(file) ); if( contentType != null ) { stream.setContentType( contentType );
/** * Add a File to the {@link org.apache.solr.common.util.ContentStream}s. * @param file The File to add. * @throws IOException if there was an error with the file. * * @see #getContentStreams() * @see org.apache.solr.common.util.ContentStreamBase.FileStream */ public void addFile(File file, String contentType) throws IOException { ContentStreamBase cs = new ContentStreamBase.FileStream(file); cs.setContentType(contentType); addContentStream(cs); }
/** * Add a File to the {@link org.apache.solr.common.util.ContentStream}s. * @param file The File to add. * @throws IOException if there was an error with the file. * * @see #getContentStreams() * @see org.apache.solr.common.util.ContentStreamBase.FileStream */ public void addFile(File file) throws IOException { addContentStream(new ContentStreamBase.FileStream(file)); }
/** * Add a File to the {@link org.apache.solr.common.util.ContentStream}s. * @param file The File to add. * @throws IOException if there was an error with the file. * * @see #getContentStreams() * @see org.apache.solr.common.util.ContentStreamBase.FileStream */ public void addFile(File file, String contentType) throws IOException { ContentStreamBase cs = new ContentStreamBase.FileStream(file); cs.setContentType(contentType); addContentStream(cs); }
@Override public String getContentType() { if(contentType==null) { contentType = attemptToDetermineContentType(); } return contentType; }