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


Java IO类代码示例

本文整理汇总了Java中org.eclipse.jetty.util.IO的典型用法代码示例。如果您正苦于以下问题:Java IO类的具体用法?Java IO怎么用?Java IO使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IO类属于org.eclipse.jetty.util包,在下文中一共展示了IO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DirectNIOBuffer

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
/**
 * @param file
 */
public DirectNIOBuffer(File file) throws IOException
{
    super(READONLY,NON_VOLATILE);
    FileInputStream fis = null;
    FileChannel fc = null;
    try
    {
        fis = new FileInputStream(file);
        fc = fis.getChannel();
        _buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, file.length());
        setGetIndex(0);
        setPutIndex((int)file.length());
        _access=IMMUTABLE;
    }
    finally
    {
        if (fc != null) try {fc.close();} catch (IOException e){LOG.ignore(e);}
        IO.close(fis);
    }
}
 
开发者ID:AdrianBZG,项目名称:PhoneChat,代码行数:24,代码来源:DirectNIOBuffer.java

示例2: getInputStream

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
@Override
public InputStream getInputStream()
    throws java.io.IOException
{     
    checkConnection();
    if (!_urlString.endsWith("!/"))
        return new FilterInputStream(super.getInputStream()) 
        {
            @Override
            public void close() throws IOException {this.in=IO.getClosedStream();}
        };

    URL url = new URL(_urlString.substring(4,_urlString.length()-2));      
    InputStream is = url.openStream();
    return is;
}
 
开发者ID:itead,项目名称:IoTgo_Android_App,代码行数:17,代码来源:JarResource.java

示例3: writeTo

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
/** 
 * @param out 
 * @param start First byte to write
 * @param count Bytes to write or -1 for all of them.
 */
public void writeTo(OutputStream out,long start,long count)
    throws IOException
{
    InputStream in = getInputStream();
    try
    {
        in.skip(start);
        if (count<0)
            IO.copy(in,out);
        else
            IO.copy(in,out,count);
    }
    finally
    {
        in.close();
    }
}
 
开发者ID:itead,项目名称:IoTgo_Android_App,代码行数:23,代码来源:Resource.java

示例4: getInputStream

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
@Override
public InputStream getInputStream()
    throws java.io.IOException
{
    checkConnection();
    if (!_urlString.endsWith("!/"))
        return new FilterInputStream(super.getInputStream()) 
        {
            @Override
            public void close() throws IOException {this.in=IO.getClosedStream();}
        };

    URL url = new URL(_urlString.substring(4,_urlString.length()-2));
    InputStream is = url.openStream();
    return is;
}
 
开发者ID:knowledgecode,项目名称:jetty-websocket-android,代码行数:17,代码来源:JarResource.java

示例5: FavIconHandler

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
public FavIconHandler() {
    byte[] bytes;
    try {
        URL fav = this.getClass().getClassLoader().getResource("favicon.ico");
        Resource r = Resource.newResource(fav);
        bytes = IO.readBytes(r.getInputStream());
    } catch (IOException e) {
        log.warn("Could not load favicon", e);
        bytes = null;
    }
    favicon = bytes;
}
 
开发者ID:danielflower,项目名称:app-runner-router,代码行数:13,代码来源:FavIconHandler.java

示例6: produceStartScript

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
private String produceStartScript(String serviceName) {
    final URL startStopResource = getClass().getResource("startstop.sh");

    String ss = null;
    try {
        ss = IO.toString(startStopResource.openStream());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    ss = String.format(ss, serviceName, getWarLocation().getAbsolutePath());
    return ss;
}
 
开发者ID:eirbjo,项目名称:jetty-console,代码行数:13,代码来源:StartStopScriptPlugin.java

示例7: shutdown

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
private void shutdown() {
    if(jettyManager != null) {
        jettyManager.shutdown();
    }
    if(jettyWorkDirectory != null) {
        IO.delete(jettyWorkDirectory);
    }
}
 
开发者ID:eirbjo,项目名称:jetty-console,代码行数:9,代码来源:JettyConsoleStarter.java

示例8: copyTo

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
@Override
public void copyTo(File destination)
    throws IOException
{
    if (isDirectory())
    {
        IO.copyDir(getFile(),destination);
    }
    else
    {
        if (destination.exists())
            throw new IllegalArgumentException(destination+" exists");
        IO.copy(getFile(),destination);
    }
}
 
开发者ID:itead,项目名称:IoTgo_Android_App,代码行数:16,代码来源:FileResource.java

示例9: ClassPathResource

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
/**
 * Specifies the classpath path containing the resource
 */
public ClassPathResource(String path) {
	this.path = path;
	InputStream is = LauncherUtils.getSeleniumResourceAsStream(path);
	if (is != null) {
		os = new ByteArrayOutputStream();
		try {
			IO.copy(is, os);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:epam,项目名称:Wilma,代码行数:16,代码来源:ClassPathResource.java

示例10: doGet

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
    logger.debug("received {} request: {}\n  Body: '{}'", request.getMethod(), request.getRequestURI(), body);

    response.setContentType("text/html;charset=utf-8");
    response.setStatus(HttpServletResponse.SC_OK);
    response.getWriter().print(this.message);
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:11,代码来源:MessageServlet.java

示例11: doGet

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
    logger.debug("received {} request: {}\n  Body: '{}'", request.getMethod(), request.getRequestURI(), body);

    response.setContentType("text/html;charset=utf-8");
    response.setStatus(HttpServletResponse.SC_OK);
    response.getWriter().println(body);
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:11,代码来源:EchoServlet.java

示例12: handleRequest

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
private void handleRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
    String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
    logger.debug("received {} request: {}\n  Body: '{}'", request.getMethod(), request.getRequestURI(), body);

    response.setContentType("text/html;charset=utf-8");
    response.setStatus(HttpServletResponse.SC_OK);
    response.getWriter().print("Hello World!");
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:9,代码来源:HelloWorldServlet.java

示例13: doGet

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
    logger.debug("received {} request: {}\n  Body: '{}'", request.getMethod(), request.getRequestURI(), body);

    response.setStatus(HttpServletResponse.SC_NO_CONTENT);
    return;
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:10,代码来源:SilentServlet.java

示例14: doPost

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
    logger.debug("received {} request: {}\n  Body: '{}'", request.getMethod(), request.getRequestURI(), body);

    response.setStatus(HttpServletResponse.SC_NO_CONTENT);
    return;
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:10,代码来源:SilentServlet.java

示例15: doPost

import org.eclipse.jetty.util.IO; //导入依赖的package包/类
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String body = IO.toString(request.getInputStream(), Charsets.UTF_8.displayName());
    logger.debug("received {} request: {}\n  Body: '{}'", request.getMethod(), request.getRequestURI(), body);
    this.receivedAlerts.add(JsonUtils.toObject(JsonUtils.parseJsonString(body), Alert.class));

    response.setContentType("text/html;charset=utf-8");
    response.setStatus(this.responseCode);
    response.getWriter().close();
}
 
开发者ID:elastisys,项目名称:scale.commons,代码行数:12,代码来源:WebhookServlet.java


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