httpcore-4.3.2

16:36:43.849 INFO  jd.cli.Main - Decompiling httpcore-4.3.2.jar
package org.apache.http;

import org.apache.http.params.HttpParams;

public abstract interface HttpMessage
{
  public abstract ProtocolVersion getProtocolVersion();
  
  public abstract boolean containsHeader(String paramString);
  
  public abstract Header[] getHeaders(String paramString);
  
  public abstract Header getFirstHeader(String paramString);
  
  public abstract Header getLastHeader(String paramString);
  
  public abstract Header[] getAllHeaders();
  
  public abstract void addHeader(Header paramHeader);
  
  public abstract void addHeader(String paramString1, String paramString2);
  
  public abstract void setHeader(Header paramHeader);
  
  public abstract void setHeader(String paramString1, String paramString2);
  
  public abstract void setHeaders(Header[] paramArrayOfHeader);
  
  public abstract void removeHeader(Header paramHeader);
  
  public abstract void removeHeaders(String paramString);
  
  public abstract HeaderIterator headerIterator();
  
  public abstract HeaderIterator headerIterator(String paramString);
  
  @Deprecated
  public abstract HttpParams getParams();
  
  @Deprecated
  public abstract void setParams(HttpParams paramHttpParams);
}

/* Location:
 * Qualified Name:     org.apache.http.HttpMessage
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.concurrent;

public abstract interface Cancellable
{
  public abstract boolean cancel();
}

/* Location:
 * Qualified Name:     org.apache.http.concurrent.Cancellable
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.concurrent;

public abstract interface FutureCallback<T>
{
  public abstract void completed(T paramT);
  
  public abstract void failed(Exception paramException);
  
  public abstract void cancelled();
}

/* Location:
 * Qualified Name:     org.apache.http.concurrent.FutureCallback
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.concurrent;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.apache.http.util.Args;

public class BasicFuture<T>
  implements Future<T>, Cancellable
{
  private final FutureCallback<T> callback;
  private volatile boolean completed;
  private volatile boolean cancelled;
  private volatile T result;
  private volatile Exception ex;
  
  public BasicFuture(FutureCallback<T> callback)
  {
    this.callback = callback;
  }
  
  public boolean isCancelled()
  {
    return cancelled;
  }
  
  public boolean isDone()
  {
    return completed;
  }
  
  private T getResult()
    throws ExecutionException
  {
    if (ex != null) {
      throw new ExecutionException(ex);
    }
    return (T)result;
  }
  
  public synchronized T get()
    throws InterruptedException, ExecutionException
  {
    while (!completed) {
      wait();
    }
    return (T)getResult();
  }
  
  public synchronized T get(long timeout, TimeUnit unit)
    throws InterruptedException, ExecutionException, TimeoutException
  {
    Args.notNull(unit, "Time unit");
    long msecs = unit.toMillis(timeout);
    long startTime = msecs <= 0L ? 0L : System.currentTimeMillis();
    long waitTime = msecs;
    if (completed) {
      return (T)getResult();
    }
    if (waitTime <= 0L) {
      throw new TimeoutException();
    }
    do
    {
      wait(waitTime);
      if (completed) {
        return (T)getResult();
      }
      waitTime = msecs - (System.currentTimeMillis() - startTime);
    } while (waitTime > 0L);
    throw new TimeoutException();
  }
  
  public boolean completed(T result)
  {
    synchronized (this)
    {
      if (completed) {
        return false;
      }
      completed = true;
      this.result = result;
      notifyAll();
    }
    if (callback != null) {
      callback.completed(result);
    }
    return true;
  }
  
  public boolean failed(Exception exception)
  {
    synchronized (this)
    {
      if (completed) {
        return false;
      }
      completed = true;
      ex = exception;
      notifyAll();
    }
    if (callback != null) {
      callback.failed(exception);
    }
    return true;
  }
  
  public boolean cancel(boolean mayInterruptIfRunning)
  {
    synchronized (this)
    {
      if (completed) {
        return false;
      }
      completed = true;
      cancelled = true;
      notifyAll();
    }
    if (callback != null) {
      callback.cancelled();
    }
    return true;
  }
  
  public boolean cancel()
  {
    return cancel(true);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.concurrent.BasicFuture
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

import java.util.Iterator;

public abstract interface HeaderElementIterator
  extends Iterator<Object>
{
  public abstract boolean hasNext();
  
  public abstract HeaderElement nextElement();
}

/* Location:
 * Qualified Name:     org.apache.http.HeaderElementIterator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

import java.io.IOException;

public abstract interface HttpServerConnection
  extends HttpConnection
{
  public abstract HttpRequest receiveRequestHeader()
    throws HttpException, IOException;
  
  public abstract void receiveRequestEntity(HttpEntityEnclosingRequest paramHttpEntityEnclosingRequest)
    throws HttpException, IOException;
  
  public abstract void sendResponseHeader(HttpResponse paramHttpResponse)
    throws HttpException, IOException;
  
  public abstract void sendResponseEntity(HttpResponse paramHttpResponse)
    throws HttpException, IOException;
  
  public abstract void flush()
    throws IOException;
}

/* Location:
 * Qualified Name:     org.apache.http.HttpServerConnection
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

import java.io.IOException;

public class ConnectionClosedException
  extends IOException
{
  private static final long serialVersionUID = 617550366255636674L;
  
  public ConnectionClosedException(String message)
  {
    super(message);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.ConnectionClosedException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

public class UnsupportedHttpVersionException
  extends ProtocolException
{
  private static final long serialVersionUID = -1348448090193107031L;
  
  public UnsupportedHttpVersionException() {}
  
  public UnsupportedHttpVersionException(String message)
  {
    super(message);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.UnsupportedHttpVersionException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

import java.io.IOException;

public class MalformedChunkCodingException
  extends IOException
{
  private static final long serialVersionUID = 2158560246948994524L;
  
  public MalformedChunkCodingException() {}
  
  public MalformedChunkCodingException(String message)
  {
    super(message);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.MalformedChunkCodingException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.IOException;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.message.BasicHeader;

@NotThreadSafe
public abstract class AbstractHttpEntity
  implements HttpEntity
{
  protected static final int OUTPUT_BUFFER_SIZE = 4096;
  protected Header contentType;
  protected Header contentEncoding;
  protected boolean chunked;
  
  public Header getContentType()
  {
    return contentType;
  }
  
  public Header getContentEncoding()
  {
    return contentEncoding;
  }
  
  public boolean isChunked()
  {
    return chunked;
  }
  
  public void setContentType(Header contentType)
  {
    this.contentType = contentType;
  }
  
  public void setContentType(String ctString)
  {
    Header h = null;
    if (ctString != null) {
      h = new BasicHeader("Content-Type", ctString);
    }
    setContentType(h);
  }
  
  public void setContentEncoding(Header contentEncoding)
  {
    this.contentEncoding = contentEncoding;
  }
  
  public void setContentEncoding(String ceString)
  {
    Header h = null;
    if (ceString != null) {
      h = new BasicHeader("Content-Encoding", ceString);
    }
    setContentEncoding(h);
  }
  
  public void setChunked(boolean b)
  {
    chunked = b;
  }
  
  @Deprecated
  public void consumeContent()
    throws IOException
  {}
}

/* Location:
 * Qualified Name:     org.apache.http.entity.AbstractHttpEntity
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.util.Args;

@NotThreadSafe
public class SerializableEntity
  extends AbstractHttpEntity
{
  private byte[] objSer;
  private Serializable objRef;
  
  public SerializableEntity(Serializable ser, boolean bufferize)
    throws IOException
  {
    Args.notNull(ser, "Source object");
    if (bufferize) {
      createBytes(ser);
    } else {
      objRef = ser;
    }
  }
  
  public SerializableEntity(Serializable ser)
  {
    Args.notNull(ser, "Source object");
    objRef = ser;
  }
  
  private void createBytes(Serializable ser)
    throws IOException
  {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream out = new ObjectOutputStream(baos);
    out.writeObject(ser);
    out.flush();
    objSer = baos.toByteArray();
  }
  
  public InputStream getContent()
    throws IOException, IllegalStateException
  {
    if (objSer == null) {
      createBytes(objRef);
    }
    return new ByteArrayInputStream(objSer);
  }
  
  public long getContentLength()
  {
    if (objSer == null) {
      return -1L;
    }
    return objSer.length;
  }
  
  public boolean isRepeatable()
  {
    return true;
  }
  
  public boolean isStreaming()
  {
    return objSer == null;
  }
  
  public void writeTo(OutputStream outstream)
    throws IOException
  {
    Args.notNull(outstream, "Output stream");
    if (objSer == null)
    {
      ObjectOutputStream out = new ObjectOutputStream(outstream);
      out.writeObject(objRef);
      out.flush();
    }
    else
    {
      outstream.write(objSer);
      outstream.flush();
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.SerializableEntity
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.HttpEntity;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.util.Args;
import org.apache.http.util.EntityUtils;

@NotThreadSafe
public class BufferedHttpEntity
  extends HttpEntityWrapper
{
  private final byte[] buffer;
  
  public BufferedHttpEntity(HttpEntity entity)
    throws IOException
  {
    super(entity);
    if ((!entity.isRepeatable()) || (entity.getContentLength() < 0L)) {
      buffer = EntityUtils.toByteArray(entity);
    } else {
      buffer = null;
    }
  }
  
  public long getContentLength()
  {
    if (buffer != null) {
      return buffer.length;
    }
    return super.getContentLength();
  }
  
  public InputStream getContent()
    throws IOException
  {
    if (buffer != null) {
      return new ByteArrayInputStream(buffer);
    }
    return super.getContent();
  }
  
  public boolean isChunked()
  {
    return (buffer == null) && (super.isChunked());
  }
  
  public boolean isRepeatable()
  {
    return true;
  }
  
  public void writeTo(OutputStream outstream)
    throws IOException
  {
    Args.notNull(outstream, "Output stream");
    if (buffer != null) {
      outstream.write(buffer);
    } else {
      super.writeTo(outstream);
    }
  }
  
  public boolean isStreaming()
  {
    return (buffer == null) && (super.isStreaming());
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.BufferedHttpEntity
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.IOException;
import java.io.OutputStream;

public abstract interface ContentProducer
{
  public abstract void writeTo(OutputStream paramOutputStream)
    throws IOException;
}

/* Location:
 * Qualified Name:     org.apache.http.entity.ContentProducer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.util.Args;

public class EntityTemplate
  extends AbstractHttpEntity
{
  private final ContentProducer contentproducer;
  
  public EntityTemplate(ContentProducer contentproducer)
  {
    this.contentproducer = ((ContentProducer)Args.notNull(contentproducer, "Content producer"));
  }
  
  public long getContentLength()
  {
    return -1L;
  }
  
  public InputStream getContent()
    throws IOException
  {
    ByteArrayOutputStream buf = new ByteArrayOutputStream();
    writeTo(buf);
    return new ByteArrayInputStream(buf.toByteArray());
  }
  
  public boolean isRepeatable()
  {
    return true;
  }
  
  public void writeTo(OutputStream outstream)
    throws IOException
  {
    Args.notNull(outstream, "Output stream");
    contentproducer.writeTo(outstream);
  }
  
  public boolean isStreaming()
  {
    return false;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.EntityTemplate
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.util.Args;

@NotThreadSafe
public class HttpEntityWrapper
  implements HttpEntity
{
  protected HttpEntity wrappedEntity;
  
  public HttpEntityWrapper(HttpEntity wrappedEntity)
  {
    this.wrappedEntity = ((HttpEntity)Args.notNull(wrappedEntity, "Wrapped entity"));
  }
  
  public boolean isRepeatable()
  {
    return wrappedEntity.isRepeatable();
  }
  
  public boolean isChunked()
  {
    return wrappedEntity.isChunked();
  }
  
  public long getContentLength()
  {
    return wrappedEntity.getContentLength();
  }
  
  public Header getContentType()
  {
    return wrappedEntity.getContentType();
  }
  
  public Header getContentEncoding()
  {
    return wrappedEntity.getContentEncoding();
  }
  
  public InputStream getContent()
    throws IOException
  {
    return wrappedEntity.getContent();
  }
  
  public void writeTo(OutputStream outstream)
    throws IOException
  {
    wrappedEntity.writeTo(outstream);
  }
  
  public boolean isStreaming()
  {
    return wrappedEntity.isStreaming();
  }
  
  @Deprecated
  public void consumeContent()
    throws IOException
  {
    wrappedEntity.consumeContent();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.HttpEntityWrapper
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.util.Args;
import org.apache.http.util.Asserts;

@NotThreadSafe
public class BasicHttpEntity
  extends AbstractHttpEntity
{
  private InputStream content;
  private long length;
  
  public BasicHttpEntity()
  {
    length = -1L;
  }
  
  public long getContentLength()
  {
    return length;
  }
  
  public InputStream getContent()
    throws IllegalStateException
  {
    Asserts.check(content != null, "Content has not been provided");
    return content;
  }
  
  public boolean isRepeatable()
  {
    return false;
  }
  
  public void setContentLength(long len)
  {
    length = len;
  }
  
  public void setContent(InputStream instream)
  {
    content = instream;
  }
  
  public void writeTo(OutputStream outstream)
    throws IOException
  {
    Args.notNull(outstream, "Output stream");
    InputStream instream = getContent();
    try
    {
      byte[] tmp = new byte['?'];
      int l;
      while ((l = instream.read(tmp)) != -1) {
        outstream.write(tmp, 0, l);
      }
    }
    finally
    {
      instream.close();
    }
  }
  
  public boolean isStreaming()
  {
    return content != null;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.BasicHttpEntity
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.util.Args;

@NotThreadSafe
public class FileEntity
  extends AbstractHttpEntity
  implements Cloneable
{
  protected final File file;
  
  @Deprecated
  public FileEntity(File file, String contentType)
  {
    this.file = ((File)Args.notNull(file, "File"));
    setContentType(contentType);
  }
  
  public FileEntity(File file, ContentType contentType)
  {
    this.file = ((File)Args.notNull(file, "File"));
    if (contentType != null) {
      setContentType(contentType.toString());
    }
  }
  
  public FileEntity(File file)
  {
    this.file = ((File)Args.notNull(file, "File"));
  }
  
  public boolean isRepeatable()
  {
    return true;
  }
  
  public long getContentLength()
  {
    return file.length();
  }
  
  public InputStream getContent()
    throws IOException
  {
    return new FileInputStream(file);
  }
  
  public void writeTo(OutputStream outstream)
    throws IOException
  {
    Args.notNull(outstream, "Output stream");
    InputStream instream = new FileInputStream(file);
    try
    {
      byte[] tmp = new byte['?'];
      int l;
      while ((l = instream.read(tmp)) != -1) {
        outstream.write(tmp, 0, l);
      }
      outstream.flush();
    }
    finally
    {
      instream.close();
    }
  }
  
  public boolean isStreaming()
  {
    return false;
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.FileEntity
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.util.Args;

@NotThreadSafe
public class InputStreamEntity
  extends AbstractHttpEntity
{
  private final InputStream content;
  private final long length;
  
  public InputStreamEntity(InputStream instream)
  {
    this(instream, -1L);
  }
  
  public InputStreamEntity(InputStream instream, long length)
  {
    this(instream, length, null);
  }
  
  public InputStreamEntity(InputStream instream, ContentType contentType)
  {
    this(instream, -1L, contentType);
  }
  
  public InputStreamEntity(InputStream instream, long length, ContentType contentType)
  {
    content = ((InputStream)Args.notNull(instream, "Source input stream"));
    this.length = length;
    if (contentType != null) {
      setContentType(contentType.toString());
    }
  }
  
  public boolean isRepeatable()
  {
    return false;
  }
  
  public long getContentLength()
  {
    return length;
  }
  
  public InputStream getContent()
    throws IOException
  {
    return content;
  }
  
  public void writeTo(OutputStream outstream)
    throws IOException
  {
    Args.notNull(outstream, "Output stream");
    InputStream instream = content;
    try
    {
      byte[] buffer = new byte['?'];
      if (length < 0L)
      {
        int l;
        while ((l = instream.read(buffer)) != -1) {
          outstream.write(buffer, 0, l);
        }
      }
      long remaining = length;
      while (remaining > 0L)
      {
        int l = instream.read(buffer, 0, (int)Math.min(4096L, remaining));
        if (l == -1) {
          break;
        }
        outstream.write(buffer, 0, l);
        remaining -= l;
      }
    }
    finally
    {
      instream.close();
    }
  }
  
  public boolean isStreaming()
  {
    return true;
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.InputStreamEntity
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.Args;

@NotThreadSafe
public class StringEntity
  extends AbstractHttpEntity
  implements Cloneable
{
  protected final byte[] content;
  
  public StringEntity(String string, ContentType contentType)
    throws UnsupportedCharsetException
  {
    Args.notNull(string, "Source string");
    Charset charset = contentType != null ? contentType.getCharset() : null;
    if (charset == null) {
      charset = HTTP.DEF_CONTENT_CHARSET;
    }
    try
    {
      content = string.getBytes(charset.name());
    }
    catch (UnsupportedEncodingException ex)
    {
      throw new UnsupportedCharsetException(charset.name());
    }
    if (contentType != null) {
      setContentType(contentType.toString());
    }
  }
  
  @Deprecated
  public StringEntity(String string, String mimeType, String charset)
    throws UnsupportedEncodingException
  {
    Args.notNull(string, "Source string");
    String mt = mimeType != null ? mimeType : "text/plain";
    String cs = charset != null ? charset : "ISO-8859-1";
    content = string.getBytes(cs);
    setContentType(mt + "; charset=" + cs);
  }
  
  public StringEntity(String string, String charset)
    throws UnsupportedCharsetException
  {
    this(string, ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), charset));
  }
  
  public StringEntity(String string, Charset charset)
  {
    this(string, ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), charset));
  }
  
  public StringEntity(String string)
    throws UnsupportedEncodingException
  {
    this(string, ContentType.DEFAULT_TEXT);
  }
  
  public boolean isRepeatable()
  {
    return true;
  }
  
  public long getContentLength()
  {
    return content.length;
  }
  
  public InputStream getContent()
    throws IOException
  {
    return new ByteArrayInputStream(content);
  }
  
  public void writeTo(OutputStream outstream)
    throws IOException
  {
    Args.notNull(outstream, "Output stream");
    outstream.write(content);
    outstream.flush();
  }
  
  public boolean isStreaming()
  {
    return false;
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.StringEntity
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.http.annotation.NotThreadSafe;
import org.apache.http.util.Args;

@NotThreadSafe
public class ByteArrayEntity
  extends AbstractHttpEntity
  implements Cloneable
{
  @Deprecated
  protected final byte[] content;
  private final byte[] b;
  private final int off;
  private final int len;
  
  public ByteArrayEntity(byte[] b, ContentType contentType)
  {
    Args.notNull(b, "Source byte array");
    content = b;
    this.b = b;
    off = 0;
    len = this.b.length;
    if (contentType != null) {
      setContentType(contentType.toString());
    }
  }
  
  public ByteArrayEntity(byte[] b, int off, int len, ContentType contentType)
  {
    Args.notNull(b, "Source byte array");
    if ((off < 0) || (off > b.length) || (len < 0) || (off + len < 0) || (off + len > b.length)) {
      throw new IndexOutOfBoundsException("off: " + off + " len: " + len + " b.length: " + b.length);
    }
    content = b;
    this.b = b;
    this.off = off;
    this.len = len;
    if (contentType != null) {
      setContentType(contentType.toString());
    }
  }
  
  public ByteArrayEntity(byte[] b)
  {
    this(b, null);
  }
  
  public ByteArrayEntity(byte[] b, int off, int len)
  {
    this(b, off, len, null);
  }
  
  public boolean isRepeatable()
  {
    return true;
  }
  
  public long getContentLength()
  {
    return len;
  }
  
  public InputStream getContent()
  {
    return new ByteArrayInputStream(b, off, len);
  }
  
  public void writeTo(OutputStream outstream)
    throws IOException
  {
    Args.notNull(outstream, "Output stream");
    outstream.write(b, off, len);
    outstream.flush();
  }
  
  public boolean isStreaming()
  {
    return false;
  }
  
  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.ByteArrayEntity
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import java.io.Serializable;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Locale;
import org.apache.http.Consts;
import org.apache.http.Header;
import org.apache.http.HeaderElement;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.annotation.Immutable;
import org.apache.http.message.BasicHeaderValueFormatter;
import org.apache.http.message.BasicHeaderValueParser;
import org.apache.http.message.ParserCursor;
import org.apache.http.util.Args;
import org.apache.http.util.CharArrayBuffer;
import org.apache.http.util.TextUtils;

@Immutable
public final class ContentType
  implements Serializable
{
  private static final long serialVersionUID = -7768694718232371896L;
  public static final ContentType APPLICATION_ATOM_XML = create("application/atom+xml", Consts.ISO_8859_1);
  public static final ContentType APPLICATION_FORM_URLENCODED = create("application/x-www-form-urlencoded", Consts.ISO_8859_1);
  public static final ContentType APPLICATION_JSON = create("application/json", Consts.UTF_8);
  public static final ContentType APPLICATION_OCTET_STREAM = create("application/octet-stream", (Charset)null);
  public static final ContentType APPLICATION_SVG_XML = create("application/svg+xml", Consts.ISO_8859_1);
  public static final ContentType APPLICATION_XHTML_XML = create("application/xhtml+xml", Consts.ISO_8859_1);
  public static final ContentType APPLICATION_XML = create("application/xml", Consts.ISO_8859_1);
  public static final ContentType MULTIPART_FORM_DATA = create("multipart/form-data", Consts.ISO_8859_1);
  public static final ContentType TEXT_HTML = create("text/html", Consts.ISO_8859_1);
  public static final ContentType TEXT_PLAIN = create("text/plain", Consts.ISO_8859_1);
  public static final ContentType TEXT_XML = create("text/xml", Consts.ISO_8859_1);
  public static final ContentType WILDCARD = create("*/*", (Charset)null);
  public static final ContentType DEFAULT_TEXT = TEXT_PLAIN;
  public static final ContentType DEFAULT_BINARY = APPLICATION_OCTET_STREAM;
  private final String mimeType;
  private final Charset charset;
  private final NameValuePair[] params;
  
  ContentType(String mimeType, Charset charset)
  {
    this.mimeType = mimeType;
    this.charset = charset;
    params = null;
  }
  
  ContentType(String mimeType, NameValuePair[] params)
    throws UnsupportedCharsetException
  {
    this.mimeType = mimeType;
    this.params = params;
    String s = getParameter("charset");
    charset = (!TextUtils.isBlank(s) ? Charset.forName(s) : null);
  }
  
  public String getMimeType()
  {
    return mimeType;
  }
  
  public Charset getCharset()
  {
    return charset;
  }
  
  public String getParameter(String name)
  {
    Args.notEmpty(name, "Parameter name");
    if (params == null) {
      return null;
    }
    for (NameValuePair param : params) {
      if (param.getName().equalsIgnoreCase(name)) {
        return param.getValue();
      }
    }
    return null;
  }
  
  public String toString()
  {
    CharArrayBuffer buf = new CharArrayBuffer(64);
    buf.append(mimeType);
    if (params != null)
    {
      buf.append("; ");
      BasicHeaderValueFormatter.INSTANCE.formatParameters(buf, params, false);
    }
    else if (charset != null)
    {
      buf.append("; charset=");
      buf.append(charset.name());
    }
    return buf.toString();
  }
  
  private static boolean valid(String s)
  {
    for (int i = 0; i < s.length(); i++)
    {
      char ch = s.charAt(i);
      if ((ch == '"') || (ch == ',') || (ch == ';')) {
        return false;
      }
    }
    return true;
  }
  
  public static ContentType create(String mimeType, Charset charset)
  {
    String type = ((String)Args.notBlank(mimeType, "MIME type")).toLowerCase(Locale.US);
    Args.check(valid(type), "MIME type may not contain reserved characters");
    return new ContentType(type, charset);
  }
  
  public static ContentType create(String mimeType)
  {
    return new ContentType(mimeType, (Charset)null);
  }
  
  public static ContentType create(String mimeType, String charset)
    throws UnsupportedCharsetException
  {
    return create(mimeType, !TextUtils.isBlank(charset) ? Charset.forName(charset) : null);
  }
  
  private static ContentType create(HeaderElement helem)
  {
    String mimeType = helem.getName();
    NameValuePair[] params = helem.getParameters();
    return new ContentType(mimeType, (params != null) && (params.length > 0) ? params : null);
  }
  
  public static ContentType parse(String s)
    throws ParseException, UnsupportedCharsetException
  {
    Args.notNull(s, "Content type");
    CharArrayBuffer buf = new CharArrayBuffer(s.length());
    buf.append(s);
    ParserCursor cursor = new ParserCursor(0, s.length());
    HeaderElement[] elements = BasicHeaderValueParser.INSTANCE.parseElements(buf, cursor);
    if (elements.length > 0) {
      return create(elements[0]);
    }
    throw new ParseException("Invalid content type: " + s);
  }
  
  public static ContentType get(HttpEntity entity)
    throws ParseException, UnsupportedCharsetException
  {
    if (entity == null) {
      return null;
    }
    Header header = entity.getContentType();
    if (header != null)
    {
      HeaderElement[] elements = header.getElements();
      if (elements.length > 0) {
        return create(elements[0]);
      }
    }
    return null;
  }
  
  public static ContentType getOrDefault(HttpEntity entity)
    throws ParseException, UnsupportedCharsetException
  {
    ContentType contentType = get(entity);
    return contentType != null ? contentType : DEFAULT_TEXT;
  }
  
  public ContentType withCharset(Charset charset)
  {
    return create(getMimeType(), charset);
  }
  
  public ContentType withCharset(String charset)
  {
    return create(getMimeType(), charset);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.entity.ContentType
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.entity;

import org.apache.http.HttpException;
import org.apache.http.HttpMessage;

public abstract interface ContentLengthStrategy
{
  public static final int IDENTITY = -1;
  public static final int CHUNKED = -2;
  
  public abstract long determineLength(HttpMessage paramHttpMessage)
    throws HttpException;
}

/* Location:
 * Qualified Name:     org.apache.http.entity.ContentLengthStrategy
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http;

public class HttpException
  extends Exception
{
  private static final long serialVersionUID = -5437299376222011036L;
  
  public HttpException() {}
  
  public HttpException(String message)
  {
    super(message);
  }
  
  public HttpException(String message, Throwable cause)
  {
    super(message);
    initCause(cause);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.HttpException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.params;

import org.apache.http.annotation.ThreadSafe;

@Deprecated
@ThreadSafe
public class SyncBasicHttpParams
  extends BasicHttpParams
{
  private static final long serialVersionUID = 5387834869062660642L;
  
  public synchronized boolean removeParameter(String name)
  {
    return super.removeParameter(name);
  }
  
  public synchronized HttpParams setParameter(String name, Object value)
  {
    return super.setParameter(name, value);
  }
  
  public synchronized Object getParameter(String name)
  {
    return super.getParameter(name);
  }
  
  public synchronized boolean isParameterSet(String name)
  {
    return super.isParameterSet(name);
  }
  
  public synchronized boolean isParameterSetLocally(String name)
  {
    return super.isParameterSetLocally(name);
  }
  
  public synchronized void setParameters(String[] names, Object value)
  {
    super.setParameters(names, value);
  }
  
  public synchronized void clear()
  {
    super.clear();
  }
  
  public synchronized Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.params.SyncBasicHttpParams
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.params;

@Deprecated
public abstract interface CoreConnectionPNames
{
  public static final String SO_TIMEOUT = "http.socket.timeout";
  public static final String TCP_NODELAY = "http.tcp.nodelay";
  public static final String SOCKET_BUFFER_SIZE = "http.socket.buffer-size";
  public static final String SO_LINGER = "http.socket.linger";
  public static final String SO_REUSEADDR = "http.socket.reuseaddr";
  public static final String CONNECTION_TIMEOUT = "http.connection.timeout";
  public static final String STALE_CONNECTION_CHECK = "http.connection.stalecheck";
  public static final String MAX_LINE_LENGTH = "http.connection.max-line-length";
  public static final String MAX_HEADER_COUNT = "http.connection.max-header-count";
  public static final String MIN_CHUNK_LIMIT = "http.connection.min-chunk-limit";
  public static final String SO_KEEPALIVE = "http.socket.keepalive";
}

/* Location:
 * Qualified Name:     org.apache.http.params.CoreConnectionPNames
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.params;

import org.apache.http.HttpVersion;

@Deprecated
public class HttpProtocolParamBean
  extends HttpAbstractParamBean
{
  public HttpProtocolParamBean(HttpParams params)
  {
    super(params);
  }
  
  public void setHttpElementCharset(String httpElementCharset)
  {
    HttpProtocolParams.setHttpElementCharset(params, httpElementCharset);
  }
  
  public void setContentCharset(String contentCharset)
  {
    HttpProtocolParams.setContentCharset(params, contentCharset);
  }
  
  public void setVersion(HttpVersion version)
  {
    HttpProtocolParams.setVersion(params, version);
  }
  
  public void setUserAgent(String userAgent)
  {
    HttpProtocolParams.setUserAgent(params, userAgent);
  }
  
  public void setUseExpectContinue(boolean useExpectContinue)
  {
    HttpProtocolParams.setUseExpectContinue(params, useExpectContinue);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.params.HttpProtocolParamBean
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.params;

@Deprecated
public class HttpConnectionParamBean
  extends HttpAbstractParamBean
{
  public HttpConnectionParamBean(HttpParams params)
  {
    super(params);
  }
  
  public void setSoTimeout(int soTimeout)
  {
    HttpConnectionParams.setSoTimeout(params, soTimeout);
  }
  
  public void setTcpNoDelay(boolean tcpNoDelay)
  {
    HttpConnectionParams.setTcpNoDelay(params, tcpNoDelay);
  }
  
  public void setSocketBufferSize(int socketBufferSize)
  {
    HttpConnectionParams.setSocketBufferSize(params, socketBufferSize);
  }
  
  public void setLinger(int linger)
  {
    HttpConnectionParams.setLinger(params, linger);
  }
  
  public void setConnectionTimeout(int connectionTimeout)
  {
    HttpConnectionParams.setConnectionTimeout(params, connectionTimeout);
  }
  
  public void setStaleCheckingEnabled(boolean staleCheckingEnabled)
  {
    HttpConnectionParams.setStaleCheckingEnabled(params, staleCheckingEnabled);
  }
}

/* Location:
 * Qualified Name:     org.apache.http.params.HttpConnectionParamBean
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.params;

import java.util.Set;

@Deprecated
public abstract class AbstractHttpParams
  implements HttpParams, HttpParamsNames
{
  public long getLongParameter(String name, long defaultValue)
  {
    Object param = getParameter(name);
    if (param == null) {
      return defaultValue;
    }
    return ((Long)param).longValue();
  }
  
  public HttpParams setLongParameter(String name, long value)
  {
    setParameter(name, Long.valueOf(value));
    return this;
  }
  
  public int getIntParameter(String name, int defaultValue)
  {
    Object param = getParameter(name);
    if (param == null) {
      return defaultValue;
    }
    return ((Integer)param).intValue();
  }
  
  public HttpParams setIntParameter(String name, int value)
  {
    setParameter(name, Integer.valueOf(value));
    return this;
  }
  
  public double getDoubleParameter(String name, double defaultValue)
  {
    Object param = getParameter(name);
    if (param == null) {
      return defaultValue;
    }
    return ((Double)param).doubleValue();
  }
  
  public HttpParams setDoubleParameter(String name, double value)
  {
    setParameter(name, Double.valueOf(value));
    return this;
  }
  
  public boolean getBooleanParameter(String name, boolean defaultValue)
  {
    Object param = getParameter(name);
    if (param == null) {
      return defaultValue;
    }
    return ((Boolean)param).booleanValue();
  }
  
  public HttpParams setBooleanParameter(String name, boolean value)
  {
    setParameter(name, value ? Boolean.TRUE : Boolean.FALSE);
    return this;
  }
  
  public boolean isParameterTrue(String name)
  {
    return getBooleanParameter(name, false);
  }
  
  public boolean isParameterFalse(String name)
  {
    return !getBooleanParameter(name, false);
  }
  
  public Set<String> getNames()
  {
    throw new UnsupportedOperationException();
  }
}

/* Location:
 * Qualified Name:     org.apache.http.params.AbstractHttpParams
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.http.params;

@Deprecated
public abstract interface HttpParams
{
  public abstract Object getParameter(String paramString);
  
  public abstract HttpParams setParameter(String paramString, Object paramObject);
  
  public abstract HttpParams copy();
  
  public abstract boolean removeParameter(String paramString);
  
  public abstract long getLongParameter(String paramString, long paramLong);
  
  public abstract HttpParams setLongParameter(String paramString, long paramLong);
  
  public abstract int getIntParameter(String paramString, int paramInt);
  
  public abstract HttpParams setIntParameter(String paramString, int paramInt);
  
  public abstract double getDoubleParameter(String paramString, double paramDouble);
  
  public abstract HttpParams setDoubleParameter(String par
1 2 3 4 5 6 7 8 9 10 11 12

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd