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


Java ProgressSource类代码示例

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


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

示例1: MeteredStream

import sun.net.ProgressSource; //导入依赖的package包/类
public MeteredStream(InputStream is, ProgressSource pi, long expected)
{
    super(is);

    this.pi = pi;
    this.expected = expected;

    if (pi != null) {
        pi.updateProgress(0, expected);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:MeteredStream.java

示例2: parseHTTP

import sun.net.ProgressSource; //导入依赖的package包/类
/** Parse the first line of the HTTP request.  It usually looks
    something like: "HTTP/1.0 <number> comment\r\n". */

public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
throws IOException {
    /* If "HTTP/*" is found in the beginning, return true.  Let
     * HttpURLConnection parse the mime header itself.
     *
     * If this isn't valid HTTP, then we don't try to parse a header
     * out of the beginning of the response into the responses,
     * and instead just queue up the output stream to it's very beginning.
     * This seems most reasonable, and is what the NN browser does.
     */

    try {
        serverInput = serverSocket.getInputStream();
        if (capture != null) {
            serverInput = new HttpCaptureInputStream(serverInput, capture);
        }
        serverInput = new BufferedInputStream(serverInput);
        return (parseHTTPHeader(responses, pi, httpuc));
    } catch (SocketTimeoutException stex) {
        // We don't want to retry the request when the app. sets a timeout
        // but don't close the server if timeout while waiting for 100-continue
        if (ignoreContinue) {
            closeServer();
        }
        throw stex;
    } catch (IOException e) {
        closeServer();
        cachedHttpClient = false;
        if (!failedOnce && requests != null) {
            failedOnce = true;
            if (getRequestMethod().equals("CONNECT")
                || streaming
                || (httpuc.getRequestMethod().equals("POST")
                    && !retryPostProp)) {
                // do not retry the request
            }  else {
                // try once more
                openServer();
                if (needsTunneling()) {
                    MessageHeader origRequests = requests;
                    httpuc.doTunneling();
                    requests = origRequests;
                }
                afterConnect();
                writeRequests(requests, poster);
                return parseHTTP(responses, pi, httpuc);
            }
        }
        throw e;
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:56,代码来源:HttpClient.java

示例3: KeepAliveStream

import sun.net.ProgressSource; //导入依赖的package包/类
/**
 * Constructor
 */
public KeepAliveStream(InputStream is, ProgressSource pi, long expected, HttpClient hc)  {
    super(is, pi, expected);
    this.hc = hc;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:KeepAliveStream.java

示例4: parseHTTP

import sun.net.ProgressSource; //导入依赖的package包/类
/** Parse the first line of the HTTP request.  It usually looks
    something like: {@literal "HTTP/1.0 <number> comment\r\n"}. */

public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
throws IOException {
    /* If "HTTP/*" is found in the beginning, return true.  Let
     * HttpURLConnection parse the mime header itself.
     *
     * If this isn't valid HTTP, then we don't try to parse a header
     * out of the beginning of the response into the responses,
     * and instead just queue up the output stream to it's very beginning.
     * This seems most reasonable, and is what the NN browser does.
     */

    try {
        serverInput = serverSocket.getInputStream();
        if (capture != null) {
            serverInput = new HttpCaptureInputStream(serverInput, capture);
        }
        serverInput = new BufferedInputStream(serverInput);
        return (parseHTTPHeader(responses, pi, httpuc));
    } catch (SocketTimeoutException stex) {
        // We don't want to retry the request when the app. sets a timeout
        // but don't close the server if timeout while waiting for 100-continue
        if (ignoreContinue) {
            closeServer();
        }
        throw stex;
    } catch (IOException e) {
        closeServer();
        cachedHttpClient = false;
        if (!failedOnce && requests != null) {
            failedOnce = true;
            if (getRequestMethod().equals("CONNECT")
                || streaming
                || (httpuc.getRequestMethod().equals("POST")
                    && !retryPostProp)) {
                // do not retry the request
            }  else {
                // try once more
                openServer();
                if (needsTunneling()) {
                    MessageHeader origRequests = requests;
                    httpuc.doTunneling();
                    requests = origRequests;
                }
                afterConnect();
                writeRequests(requests, poster);
                return parseHTTP(responses, pi, httpuc);
            }
        }
        throw e;
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:56,代码来源:HttpClient.java

示例5: parseHTTP

import sun.net.ProgressSource; //导入依赖的package包/类
/** Parse the first line of the HTTP request.  It usually looks
    something like: "HTTP/1.0 <number> comment\r\n". */

public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
throws IOException {
    /* If "HTTP/*" is found in the beginning, return true.  Let
     * HttpURLConnection parse the mime header itself.
     *
     * If this isn't valid HTTP, then we don't try to parse a header
     * out of the beginning of the response into the responses,
     * and instead just queue up the output stream to it's very beginning.
     * This seems most reasonable, and is what the NN browser does.
     */

    try {
        serverInput = serverSocket.getInputStream();
        if (capture != null) {
            serverInput = new HttpCaptureInputStream(serverInput, capture);
        }
        serverInput = new BufferedInputStream(serverInput);
        return (parseHTTPHeader(responses, pi, httpuc));
    } catch (SocketTimeoutException stex) {
        // We don't want to retry the request when the app. sets a timeout
        // but don't close the server if timeout while waiting for 100-continue
        if (ignoreContinue) {
            closeServer();
        }
        throw stex;
    } catch (IOException e) {
        closeServer();
        cachedHttpClient = false;
        if (!failedOnce && requests != null) {
            failedOnce = true;
            if (httpuc.getRequestMethod().equals("POST") && (!retryPostProp || streaming)) {
                // do not retry the request
            }  else {
                // try once more
                openServer();
                if (needsTunneling()) {
                    httpuc.doTunneling();
                }
                afterConnect();
                writeRequests(requests, poster);
                return parseHTTP(responses, pi, httpuc);
            }
        }
        throw e;
    }

}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:51,代码来源:HttpClient.java

示例6: parseHTTP

import sun.net.ProgressSource; //导入依赖的package包/类
/** Parse the first line of the HTTP request.  It usually looks
    something like: "HTTP/1.0 <number> comment\r\n". */

public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
throws IOException {
    /* If "HTTP/*" is found in the beginning, return true.  Let
     * HttpURLConnection parse the mime header itself.
     *
     * If this isn't valid HTTP, then we don't try to parse a header
     * out of the beginning of the response into the responses,
     * and instead just queue up the output stream to it's very beginning.
     * This seems most reasonable, and is what the NN browser does.
     */

    try {
        serverInput = serverSocket.getInputStream();
        if (capture != null) {
            serverInput = new HttpCaptureInputStream(serverInput, capture);
        }
        serverInput = new BufferedInputStream(serverInput);
        return (parseHTTPHeader(responses, pi, httpuc));
    } catch (SocketTimeoutException stex) {
        // We don't want to retry the request when the app. sets a timeout
        // but don't close the server if timeout while waiting for 100-continue
        if (ignoreContinue) {
            closeServer();
        }
        throw stex;
    } catch (IOException e) {
        closeServer();
        cachedHttpClient = false;
        if (!failedOnce && requests != null) {
            failedOnce = true;
            if (getRequestMethod().equals("CONNECT") ||
                (httpuc.getRequestMethod().equals("POST") &&
                (!retryPostProp || streaming))) {
                // do not retry the request
            }  else {
                // try once more
                openServer();
                if (needsTunneling()) {
                    httpuc.doTunneling();
                }
                afterConnect();
                writeRequests(requests, poster);
                return parseHTTP(responses, pi, httpuc);
            }
        }
        throw e;
    }

}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:53,代码来源:HttpClient.java

示例7: parseHTTP

import sun.net.ProgressSource; //导入依赖的package包/类
/** Parse the first line of the HTTP request.  It usually looks
    something like: "HTTP/1.0 <number> comment\r\n". */

public boolean parseHTTP(MessageHeader responses, ProgressSource pi, HttpURLConnection httpuc)
throws IOException {
    /* If "HTTP/*" is found in the beginning, return true.  Let
     * HttpURLConnection parse the mime header itself.
     *
     * If this isn't valid HTTP, then we don't try to parse a header
     * out of the beginning of the response into the responses,
     * and instead just queue up the output stream to it's very beginning.
     * This seems most reasonable, and is what the NN browser does.
     */

    try {
        serverInput = serverSocket.getInputStream();
        if (capture != null) {
            serverInput = new HttpCaptureInputStream(serverInput, capture);
        }
        serverInput = new BufferedInputStream(serverInput);
        return (parseHTTPHeader(responses, pi, httpuc));
    } catch (SocketTimeoutException stex) {
        // We don't want to retry the request when the app. sets a timeout
        // but don't close the server if timeout while waiting for 100-continue
        if (ignoreContinue) {
            closeServer();
        }
        throw stex;
    } catch (IOException e) {
        closeServer();
        cachedHttpClient = false;
        if (!failedOnce && requests != null) {
            failedOnce = true;
            if (getRequestMethod().equals("CONNECT") ||
                (httpuc.getRequestMethod().equals("POST") &&
                (!retryPostProp || streaming))) {
                // do not retry the request
            }  else {
                // try once more
                openServer();
                if (needsTunneling()) {
                    MessageHeader origRequests = requests;
                    httpuc.doTunneling();
                    requests = origRequests;
                }
                afterConnect();
                writeRequests(requests, poster);
                return parseHTTP(responses, pi, httpuc);
            }
        }
        throw e;
    }

}
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:55,代码来源:HttpClient.java


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