本文整理了Java中org.apache.jena.atlas.io.IO.readWholeFileAsUTF8()
方法的一些代码示例,展示了IO.readWholeFileAsUTF8()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IO.readWholeFileAsUTF8()
方法的具体详情如下:
包路径:org.apache.jena.atlas.io.IO
类名称:IO
方法名:readWholeFileAsUTF8
[英]Read a whole stream as UTF-8
[中]将整个流读取为UTF-8
代码示例来源:origin: apache/jena
/** Read a whole file as UTF-8
* @param filename
* @return String
* @throws IOException
*/
public static String readWholeFileAsUTF8(String filename) throws IOException {
try ( InputStream in = new FileInputStream(filename) ) {
return readWholeFileAsUTF8(in) ;
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
/** Read a whole file as UTF-8
* @param filename
* @return String
* @throws IOException
*/
public static String readWholeFileAsUTF8(String filename) throws IOException {
InputStream in = new FileInputStream(filename) ;
return readWholeFileAsUTF8(in) ;
}
代码示例来源:origin: apache/jena
@Override
public void handle(String baseIRI, HttpResponse response) throws IOException {
HttpEntity entity = response.getEntity();
if ( entity == null ) {
result = null ;
return ;
}
try(InputStream instream = entity.getContent()) {
result = IO.readWholeFileAsUTF8(instream);
}
}
代码示例来源:origin: org.apache.jena/jena-base
/** Read a whole file as UTF-8
* @param filename
* @return String
* @throws IOException
*/
public static String readWholeFileAsUTF8(String filename) throws IOException {
try ( InputStream in = new FileInputStream(filename) ) {
return readWholeFileAsUTF8(in) ;
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
@Override
public void handle(String baseIRI, HttpResponse response) throws IOException {
HttpEntity entity = response.getEntity();
InputStream instream = entity.getContent();
result = IO.readWholeFileAsUTF8(instream);
instream.close();
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-client
private static String readResponse(HttpResponse resp) {
HttpEntity e = resp.getEntity();
if ( e != null ) {
try ( InputStream ins = e.getContent() ) {
return IO.readWholeFileAsUTF8(ins);
} catch (IOException ex) { ex.printStackTrace(); }
}
return null;
}
}
代码示例来源:origin: apache/jena
/** Read a whole stream as UTF-8
*
* @param in InputStream to be read
* @return String
* @throws IOException
*/
public static String readWholeFileAsUTF8(InputStream in) throws IOException {
// Don't buffer - we're going to read in large chunks anyway
try ( Reader r = asUTF8(in) ) {
return readWholeFileAsUTF8(r) ;
}
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
/** Read a whole stream as UTF-8
*
* @param in InputStream to be read
* @return String
* @throws IOException
*/
public static String readWholeFileAsUTF8(InputStream in) throws IOException
{
// Don't buffer - we're going to read in large chunks anyway
Reader r = asUTF8(in) ;
return readWholeFileAsUTF8(r) ;
}
代码示例来源:origin: org.apache.jena/jena-base
/** Read a whole stream as UTF-8
*
* @param in InputStream to be read
* @return String
* @throws IOException
*/
public static String readWholeFileAsUTF8(InputStream in) throws IOException {
// Don't buffer - we're going to read in large chunks anyway
try ( Reader r = asUTF8(in) ) {
return readWholeFileAsUTF8(r) ;
}
}
代码示例来源:origin: apache/jena
protected void executeBody(HttpAction action) {
String queryString = null ;
try {
InputStream input = action.request.getInputStream() ;
queryString = IO.readWholeFileAsUTF8(input) ;
} catch (IOException ex) {
ServletOps.errorOccurred(ex) ;
}
execute(queryString, action) ;
}
代码示例来源:origin: org.apache.jena/jena-fuseki-core
protected void executeBody(HttpAction action) {
String queryString = null ;
try {
InputStream input = action.request.getInputStream() ;
queryString = IO.readWholeFileAsUTF8(input) ;
} catch (IOException ex) {
ServletOps.errorOccurred(ex) ;
}
execute(queryString, action) ;
}
代码示例来源:origin: apache/jena
private static long read(String filename) {
try {
String str = IO.readWholeFileAsUTF8(filename) ;
if ( str.endsWith("\n") ) {
str = str.substring(0, str.length()-1) ;
}
str = str.trim() ;
return Long.parseLong(str) ;
}
catch (IOException ex) {
Log.error(TransInteger.class, "IOException: " + ex.getMessage(), ex) ;
IO.exception(ex) ;
}
catch (NumberFormatException ex) {
Log.error(TransInteger.class, "NumberformatException: " + ex.getMessage()) ;
throw new InternalErrorException(ex) ;
}
// Not reached.
return Long.MIN_VALUE ;
}
代码示例来源:origin: apache/jena
public static void main(String...args) throws IOException
{
// Reserved characters + space
char reserved[] =
{' ',
'\n','\t',
'!', '*', '"', '\'', '(', ')', ';', ':', '@', '&',
'=', '+', '$', ',', '/', '?', '%', '#', '[', ']'} ;
char[] other = {'<', '>', '~', '.', '{', '}', '|', '\\', '-', '`', '_', '^'} ;
if ( args.length == 0 ) {
String x = IO.readWholeFileAsUTF8(System.in);
String y = StrUtils.encodeHex(x, '%', reserved) ;
System.out.println(y) ;
return;
}
for ( String x : args) {
// Not URLEncoder which does www-form-encoding.
String y = StrUtils.encodeHex(x, '%', reserved) ;
System.out.println(y) ;
// String s2 = URLEncoder.encode(s, "utf-8") ;
// System.out.println(s2) ;
}
}
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-base
private static long read(String filename) {
try {
String str = IO.readWholeFileAsUTF8(filename) ;
if ( str.endsWith("\n") ) {
str = str.substring(0, str.length()-1) ;
}
str = str.trim() ;
return Long.parseLong(str) ;
}
catch (IOException ex) {
Log.error(PersistentCounter.class, "IOException: " + ex.getMessage(), ex) ;
throw IOX.exception(ex);
}
catch (NumberFormatException ex) {
Log.error(PersistentCounter.class, "NumberformatException: " + ex.getMessage()) ;
throw new InternalErrorException(ex) ;
}
}
代码示例来源:origin: org.apache.jena/jena-dboe-transaction
private static long read(String filename) {
try {
String str = IO.readWholeFileAsUTF8(filename) ;
if ( str.endsWith("\n") ) {
str = str.substring(0, str.length()-1) ;
}
str = str.trim() ;
return Long.parseLong(str) ;
}
catch (IOException ex) {
Log.error(TransInteger.class, "IOException: " + ex.getMessage(), ex) ;
IO.exception(ex) ;
}
catch (NumberFormatException ex) {
Log.error(TransInteger.class, "NumberformatException: " + ex.getMessage()) ;
throw new InternalErrorException(ex) ;
}
// Not reached.
return Long.MIN_VALUE ;
}
代码示例来源:origin: org.apache.jena/jena-cmds
public static void main(String...args) throws IOException
{
// Reserved characters + space
char reserved[] =
{' ',
'\n','\t',
'!', '*', '"', '\'', '(', ')', ';', ':', '@', '&',
'=', '+', '$', ',', '/', '?', '%', '#', '[', ']'} ;
char[] other = {'<', '>', '~', '.', '{', '}', '|', '\\', '-', '`', '_', '^'} ;
if ( args.length == 0 ) {
String x = IO.readWholeFileAsUTF8(System.in);
String y = StrUtils.encodeHex(x, '%', reserved) ;
System.out.println(y) ;
return;
}
for ( String x : args) {
// Not URLEncoder which does www-form-encoding.
String y = StrUtils.encodeHex(x, '%', reserved) ;
System.out.println(y) ;
// String s2 = URLEncoder.encode(s, "utf-8") ;
// System.out.println(s2) ;
}
}
}
代码示例来源:origin: apache/jena
String rawLockInfo = IO.readWholeFileAsUTF8(lockFile.getAbsolutePath());
if (rawLockInfo.endsWith("\n")) {
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-client
String s = IO.readWholeFileAsUTF8(x) ;
return JSON.parseAny(s) ;
} catch (IOException ex) { throw IOX.exception(ex); }
内容来源于网络,如有侵权,请联系作者删除!