本文整理了Java中info.aduna.io.IOUtil.readString()
方法的一些代码示例,展示了IOUtil.readString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtil.readString()
方法的具体详情如下:
包路径:info.aduna.io.IOUtil
类名称:IOUtil
方法名:readString
[英]Read the contents as a string from the given file.
[中]从给定文件中以字符串形式读取内容。
代码示例来源:origin: info.aduna.commons/aduna-commons-io
public static String readString(InputStream in)
throws IOException
{
return readString(new InputStreamReader(in));
}
代码示例来源:origin: info.aduna.commons/aduna-commons-io
/**
* Read the contents as a string from the given file.
*/
public static String readString(File file)
throws IOException
{
FileInputStream in = new FileInputStream(file);
try {
return readString(in);
}
finally {
in.close();
}
}
代码示例来源:origin: org.openrdf.sesame/sesame-config
/**
* Load configuration settings from the specified file.
*
* @param file
* the file to load from
* @return the contents of the file as a String, or null if the file did not
* exist
* @throws IOException
* if the contents of the file could not be read due to an I/O
* problem
*/
public static String loadConfigurationContents(File file)
throws IOException
{
String result = null;
if (file.exists()) {
result = IOUtil.readString(file);
}
return result;
}
代码示例来源:origin: blazegraph/database
public String getQueryString() throws Exception {
if (queryString == null) {
InputStream stream = new URL(queryFileURL).openStream();
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
}
finally {
stream.close();
}
}
return queryString;
}
代码示例来源:origin: blazegraph/database
protected final String readQueryString()
throws IOException
{
InputStream stream = new URL(queryFileURL).openStream();
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
}
finally {
stream.close();
}
}
代码示例来源:origin: org.openrdf.sesame/sesame-queryparser-sparql-compliance
private String readQueryString()
throws IOException
{
InputStream stream = new URL(queryFileURL).openStream();
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
}
finally {
stream.close();
}
}
代码示例来源:origin: blazegraph/database
protected String readUpdateString()
throws IOException
{
InputStream stream = new URL(requestFileURL).openStream();
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
}
finally {
stream.close();
}
}
代码示例来源:origin: org.openrdf.sesame/sesame-sparql-testsuite
private String readUpdateString()
throws IOException
{
InputStream stream = new URL(requestFileURL).openStream();
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
}
finally {
stream.close();
}
}
代码示例来源:origin: org.openrdf.sesame/sesame-sparql-testsuite
protected final String readQueryString()
throws IOException
{
InputStream stream = new URL(queryFileURL).openStream();
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
}
finally {
stream.close();
}
}
代码示例来源:origin: blazegraph/database
/**
* Read the query string from the specified resource
*
* @param queryResource
* @return
* @throws RepositoryException
* @throws IOException
*/
private String readQueryString(final String queryResource) throws RepositoryException, IOException {
final InputStream stream = TestFederatedQuery.class
.getResourceAsStream(TEST_RESOURCE_PATH + queryResource);
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
} finally {
stream.close();
}
}
代码示例来源:origin: org.openrdf.sesame/sesame-serql-testsuite
private String readQuery()
throws IOException
{
InputStream stream = url(queryFile).openStream();
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
}
finally {
stream.close();
}
}
代码示例来源:origin: info.aduna.commons/aduna-commons-io
public static String readString(URL url)
throws IOException
{
Reader reader = urlToReader(url);
try {
return readString(reader);
}
finally {
reader.close();
}
}
代码示例来源:origin: blazegraph/database
protected String readInputData(Dataset dataset) throws Exception {
final StringBuilder sb = new StringBuilder();
if (dataset != null) {
Set<URI> graphURIs = new HashSet<URI>();
graphURIs.addAll(dataset.getDefaultGraphs());
graphURIs.addAll(dataset.getNamedGraphs());
for (Resource graphURI : graphURIs) {
URL graphURL = new URL(graphURI.toString());
InputStream in = graphURL.openStream();
sb.append(IOUtil.readString(in));
}
}
return sb.toString();
}
代码示例来源:origin: net.fortytwo.stream/stream42-sparql
protected TupleExpr loadQuery(final String fileName) throws Exception {
InputStream in = RDFStreamProcessor.class.getResourceAsStream(fileName);
String query = IOUtil.readString(in);
in.close();
ParsedQuery pq = queryParser.parseQuery(query, BASE_IRI);
return pq.getTupleExpr();
}
代码示例来源:origin: blazegraph/database
protected String readUpdateString()
throws IOException
{
InputStream stream = new URL(requestFileURL).openStream();
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
}
finally {
stream.close();
}
}
代码示例来源:origin: blazegraph/database
public String getQueryString() throws Exception {
if (queryString == null) {
InputStream stream = new URL(queryFileURL).openStream();
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
}
finally {
stream.close();
}
}
return queryString;
}
代码示例来源:origin: blazegraph/database
protected final String readQueryString()
throws IOException
{
InputStream stream = new URL(queryFileURL).openStream();
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
}
finally {
stream.close();
}
}
代码示例来源:origin: blazegraph/database
/**
* Read the query string from the specified resource
*
* @param queryResource
* @return
* @throws RepositoryException
* @throws IOException
*/
private String readQueryString(final String queryResource) throws RepositoryException, IOException {
final InputStream stream = TestFederatedQuery.class
.getResourceAsStream(TEST_RESOURCE_PATH + queryResource);
try {
return IOUtil.readString(new InputStreamReader(stream, "UTF-8"));
} finally {
stream.close();
}
}
代码示例来源:origin: blazegraph/database
private void prepareForWire() throws Exception {
if (file != null) {
// set the data
data = IOUtil.readBytes(file);
} else if (is != null) {
// set the data
data = IOUtil.readBytes(is);
} else if (reader != null) {
// set the data
data = IOUtil.readString(reader).getBytes();
} else if (stmts != null) {
// set the data and content type (TRIG by default)
format = RDFFormat.TRIG;
data = serialize(stmts, format);
}
}
代码示例来源:origin: blazegraph/database
protected String readInputData(Dataset dataset) throws Exception {
final StringBuilder sb = new StringBuilder();
if (dataset != null) {
Set<URI> graphURIs = new HashSet<URI>();
graphURIs.addAll(dataset.getDefaultGraphs());
graphURIs.addAll(dataset.getNamedGraphs());
for (Resource graphURI : graphURIs) {
URL graphURL = new URL(graphURI.toString());
InputStream in = graphURL.openStream();
sb.append(IOUtil.readString(in));
}
}
return sb.toString();
}
内容来源于网络,如有侵权,请联系作者删除!