本文整理汇总了Java中io.advantageous.boon.core.IO.read方法的典型用法代码示例。如果您正苦于以下问题:Java IO.read方法的具体用法?Java IO.read怎么用?Java IO.read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.advantageous.boon.core.IO
的用法示例。
在下文中一共展示了IO.read方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWebPageContents
import io.advantageous.boon.core.IO; //导入方法依赖的package包/类
public String getWebPageContents() {
if (webPageContents == null || webPageContents.isEmpty()) {
final String htmlPageLocationInitial = getHtmlPageLocation();
final String pageLocation;
pageLocation = htmlPageLocationInitial.startsWith("/") ?
htmlPageLocationInitial.substring(1, htmlPageLocationInitial.length()) :
htmlPageLocationInitial;
webPageContents = IO.read(
Thread.currentThread()
.getContextClassLoader()
.getResourceAsStream(pageLocation)
);
}
return webPageContents;
}
示例2: readBody
import io.advantageous.boon.core.IO; //导入方法依赖的package包/类
public static String readBody(final HttpServletRequest request) {
try {
final ServletInputStream inputStream = request.getInputStream();
final String read = IO.read(inputStream, StandardCharsets.UTF_8);
inputStream.close();
return read;
} catch (final IOException e) {
throw new IllegalStateException(e);
}
}
示例3: parse
import io.advantageous.boon.core.IO; //导入方法依赖的package包/类
@Override
public final <T> T parse( Class<T> type, Reader reader ) {
if (copyBuf==null) {
copyBuf = new char[bufSize];
}
charBuf = IO.read( reader, charBuf, bufSize, copyBuf );
return parse( type, charBuf.readForRecycle() );
}
示例4: parseAsStream
import io.advantageous.boon.core.IO; //导入方法依赖的package包/类
@Override
public final <T> T parseAsStream( Class<T> type, byte[] value ) {
if (copyBuf==null) {
copyBuf = new char[bufSize];
}
charBuf = IO.read( new InputStreamReader ( new InMemoryInputStream(value), charset ), charBuf, value.length, copyBuf );
return this.basicParser.parse ( type, charBuf.readForRecycle () );
}
示例5: parse
import io.advantageous.boon.core.IO; //导入方法依赖的package包/类
@Override
public Object parse( Reader reader ) {
if (copyBuf==null) {
copyBuf = new char[bufSize];
}
fileInputBuf = IO.read ( reader, fileInputBuf, bufSize, copyBuf );
return parse( fileInputBuf.readForRecycle() );
}
示例6: parse
import io.advantageous.boon.core.IO; //导入方法依赖的package包/类
@Override
public <T> T parse( Class<T> type, Reader reader ) {
if (copyBuf==null) {
copyBuf = new char[bufSize];
}
fileInputBuf = IO.read( reader, fileInputBuf, bufSize, copyBuf );
return parse( type, fileInputBuf.readForRecycle() );
}
示例7: handle
import io.advantageous.boon.core.IO; //导入方法依赖的package包/类
public void handle( HttpExchange t ) throws IOException {
InputStream requestBody = t.getRequestBody();
String body = IO.read( requestBody );
Headers requestHeaders = t.getRequestHeaders();
body = body + "\n" + copy( requestHeaders ).toString();
t.sendResponseHeaders( 200, body.length() );
OutputStream os = t.getResponseBody();
os.write( body.getBytes() );
os.close();
}
示例8: testNest
import io.advantageous.boon.core.IO; //导入方法依赖的package包/类
@Test
public void testNest () {
String nest = IO.read ( "files/nest.json" );
this.jsonParserAndMapper.parse ( Map.class, nest );
}
示例9: noNest
import io.advantageous.boon.core.IO; //导入方法依赖的package包/类
@Test
public void noNest () {
String json = IO.read ( "files/nonest.json" );
this.jsonParserAndMapper.parse ( Map.class, json );
}
示例10: main
import io.advantageous.boon.core.IO; //导入方法依赖的package包/类
public static void main(String... args) throws Exception {
File file = File.createTempFile("foo", "json");
final JsonParserAndMapper jsonMapper =
new JsonParserFactory()
.createFastObjectMapperParser();
final JsonSerializer jsonSerializer = new JsonSerializerFactory()
.create();
final Sales salesOut = new Sales(1, "foo");
final String json = jsonSerializer.serialize(salesOut).toString();
puts(json);
IO.write(file.toPath(), json);
final String jsonIn = IO.read(file);
puts("OUT", salesOut, jsonIn);
final Sales salesIn = jsonMapper.parse(Sales.class, jsonIn);
puts("OUT", salesIn, salesOut);
assertEquals(salesOut, salesIn);
}