home *** CD-ROM | disk | FTP | other *** search
- package sun.net.www.http;
-
- import java.io.ByteArrayInputStream;
- import java.io.DataInputStream;
- import java.io.IOException;
- import java.io.InputStream;
- import sun.net.ProgressData;
- import sun.net.ProgressEntry;
- import sun.net.www.MeteredStream;
-
- public class KeepAliveStream extends MeteredStream {
- // $FF: renamed from: hc sun.net.www.http.HttpClient
- HttpClient field_0;
- boolean hurried;
-
- public KeepAliveStream(InputStream var1, ProgressEntry var2, HttpClient var3) {
- super(var1, var2);
- this.field_0 = var3;
- }
-
- public void close() throws IOException {
- try {
- if (super.expected > super.count) {
- ((MeteredStream)this).skip((long)(super.expected - super.count));
- }
-
- if (!super.closed && !this.hurried) {
- HttpClient.finished(this.field_0);
- }
- } finally {
- ProgressData.pdata.unregister(super.te);
- super.closed = true;
- }
-
- }
-
- public boolean markSupported() {
- return false;
- }
-
- public void mark(int var1) {
- }
-
- public void reset() throws IOException {
- throw new IOException("mark/reset not supported");
- }
-
- public synchronized boolean hurry() {
- try {
- if (!super.closed && super.count < super.expected) {
- if (super.in.available() < super.expected - super.count) {
- return false;
- } else {
- byte[] var1 = new byte[super.expected - super.count];
- DataInputStream var2 = new DataInputStream(super.in);
- var2.readFully(var1);
- super.in = new ByteArrayInputStream(var1);
- this.hurried = true;
- return true;
- }
- } else {
- return false;
- }
- } catch (IOException var3) {
- return false;
- }
- }
- }
-