Code example for InputStreamEntity

Methods: setContentType

0
        } 
    } 
 
    private boolean _createGraph(final URI graphURI, final InputStream in, final MediaType mediaType) throws IOException {
        final HttpPut put = new HttpPut(getGraphURI(graphURI));
        final InputStreamEntity entity = new InputStreamEntity(in, -1);
        entity.setContentType(mediaType != null ? mediaType.toString() : null);
        put.setEntity(entity);
        final int status = getStatusCode(put);
        return status == 200 || status == 201 || status == 204;
    } 
 
    /** 
     * Creates a graph using the content of the provided file. 
     *  
     * This method tries to detect the media type of the graph content by the 
     * file name extension. 
     * 
     * @param file The file to read the graph from. 
     * @return The URI of the created graph or {@code null} if the graph was not created. 
Stop searching for code, let great code find you!  Add Codota to your java IDE