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


Java Buffer类代码示例

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


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

示例1: test

import org.mortbay.io.Buffer; //导入依赖的package包/类
public void test() throws Exception
{
	StreamingMarketQuote quote = new StreamingMarketQuote();
	
	ContentExchange ex = new ContentExchange(true)
	{
		// tell me what kind of response code we got
		protected void onResponseComplete() throws IOException
		{
			int status = getResponseStatus();
			if (status == 200)
				System.out.println("Successfully connected");
			else
				System.out.println("Error Code Received: " + status);
		}

		// print out any response data we get along the stream
		protected void onResponseContent(Buffer data)
		{
			System.out.println(data);
		}
	};
	
	ContentExchange request = quote.stream(ex, new Symbol("IBM"));
	request.waitForDone();
}
 
开发者ID:Ccook,项目名称:conniption,代码行数:27,代码来源:StreamingMarketQuoteTest.java

示例2: inferMimeType

import org.mortbay.io.Buffer; //导入依赖的package包/类
/**
 * Infer the mime type for the response based on the extension of the request
 * URI. Returns null if unknown.
 */
private String inferMimeType(ServletRequest request) {
  String path = ((HttpServletRequest)request).getRequestURI();
  ContextHandler.SContext sContext = (ContextHandler.SContext)config.getServletContext();
  MimeTypes mimes = sContext.getContextHandler().getMimeTypes();
  Buffer mimeBuffer = mimes.getMimeByExtension(path);
  return (mimeBuffer == null) ? null : mimeBuffer.toString();
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:12,代码来源:HttpServer2.java

示例3: fill

import org.mortbay.io.Buffer; //导入依赖的package包/类
public int fill(Buffer buffer) throws IOException
{
    Buffer buf = buffer.buffer();
    int len=0;

    NIOBuffer nbuf = (NIOBuffer)buf;
    ByteBuffer bbuf=nbuf.getByteBuffer();

    synchronized(nbuf)
    {
        try
        {
            if (bbuf.position() == 0)
            {
                bbuf.position(buffer.putIndex());
                len=_channel.read(bbuf);
            }
        }
        finally
        {
            buffer.setPutIndex(bbuf.position());
            bbuf.position(0);
        }
    }

    return len;
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:28,代码来源:GrizzlyEndPoint.java

示例4: inferMimeType

import org.mortbay.io.Buffer; //导入依赖的package包/类
/**
 * Infer the mime type for the response based on the extension of the 
 * request URI. Returns null if unknown.
 */
private String inferMimeType(ServletRequest request) {
  String path = ((HttpServletRequest)request).getRequestURI();
  ContextHandler.SContext sContext = 
    (ContextHandler.SContext)config.getServletContext();
  MimeTypes mimes = sContext.getContextHandler().getMimeTypes();
  Buffer mimeBuffer = mimes.getMimeByExtension(path);
  return (mimeBuffer == null) ? null : mimeBuffer.toString();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:13,代码来源:HttpServer.java

示例5: fill

import org.mortbay.io.Buffer; //导入依赖的package包/类
@Override
public int fill(Buffer buffer) throws IOException {
  int len = super.fill(buffer);
  if (len < 0)
    getChannel().close();
  return len;
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:8,代码来源:JettyServer.java

示例6: onResponseStatus

import org.mortbay.io.Buffer; //导入依赖的package包/类
protected void onResponseStatus(Buffer version, int status, Buffer reason) throws IOException
{
    super.onResponseStatus(version,status,reason);
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:5,代码来源:BayeuxClient.java

示例7: onResponseHeader

import org.mortbay.io.Buffer; //导入依赖的package包/类
protected void onResponseHeader(Buffer name, Buffer value) throws IOException
{
    super.onResponseHeader(name,value);
    if (HttpHeaders.CACHE.getOrdinal(name)==HttpHeaders.SET_COOKIE_ORDINAL)
    {
        String cname=null;
        String cvalue=null;

        QuotedStringTokenizer tok=new QuotedStringTokenizer(value.toString(),"=;",false,false);
        tok.setSingle(false);

        if (tok.hasMoreElements())
            cname=tok.nextToken();
        if (tok.hasMoreElements())
            cvalue=tok.nextToken();

        Cookie cookie=new Cookie(cname,cvalue);

        while (tok.hasMoreTokens())
        {
            String token=tok.nextToken();
            if ("Version".equalsIgnoreCase(token))
                cookie.setVersion(Integer.parseInt(tok.nextToken()));
            else if ("Comment".equalsIgnoreCase(token))
                cookie.setComment(tok.nextToken());
            else if ("Path".equalsIgnoreCase(token))
                cookie.setPath(tok.nextToken());
            else if ("Domain".equalsIgnoreCase(token))
                cookie.setDomain(tok.nextToken());
            else if ("Expires".equalsIgnoreCase(token))
            {
                tok.nextToken();
                // TODO
            }
            else if ("Max-Age".equalsIgnoreCase(token))
            {
                tok.nextToken();
                // TODO
            }
            else if ("Secure".equalsIgnoreCase(token))
                cookie.setSecure(true);
        }

        BayeuxClient.this.setCookie(cookie);
    }
}
 
开发者ID:iMartinezMateu,项目名称:openbravo-pos,代码行数:47,代码来源:BayeuxClient.java

示例8: newBuffer

import org.mortbay.io.Buffer; //导入依赖的package包/类
protected Buffer newBuffer(int size)
{
   return new ByteArrayBuffer(size);
}
 
开发者ID:tolo,项目名称:JServer,代码行数:5,代码来源:SingleEndPointConnector.java


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