当前位置: 首页>>代码示例>>Java>>正文


Java IO.read方法代码示例

本文整理汇总了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;
    }
 
开发者ID:advantageous,项目名称:qbit,代码行数:19,代码来源:AdminBuilder.java

示例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);
    }
}
 
开发者ID:advantageous,项目名称:qbit-extensions,代码行数:11,代码来源:QBitServletUtil.java

示例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() );

}
 
开发者ID:advantageous,项目名称:boon,代码行数:12,代码来源:JsonMappingParser.java

示例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 () );
}
 
开发者ID:advantageous,项目名称:boon,代码行数:10,代码来源:JsonMappingParser.java

示例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() );

}
 
开发者ID:advantageous,项目名称:boon,代码行数:12,代码来源:BaseJsonParser.java

示例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() );

}
 
开发者ID:advantageous,项目名称:boon,代码行数:12,代码来源:BaseJsonParserAndMapper.java

示例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();
        }
 
开发者ID:advantageous,项目名称:boon,代码行数:12,代码来源:HTTPTest.java

示例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 );


}
 
开发者ID:advantageous,项目名称:boon,代码行数:11,代码来源:JsonCharArrayTest.java

示例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 );


}
 
开发者ID:advantageous,项目名称:boon,代码行数:11,代码来源:JsonCharArrayTest.java

示例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);



    }
 
开发者ID:advantageous,项目名称:boon,代码行数:40,代码来源:JsonWorkingWithNonSerializableObjects.java


注:本文中的io.advantageous.boon.core.IO.read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。