Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 32 package org.apache.commons.httpclient.methods; 33 34 import java.io.IOException ; 35 import java.io.OutputStream ; 36 37 42 public class ByteArrayRequestEntity implements RequestEntity { 43 44 45 private byte[] content; 46 47 48 private String contentType; 49 50 54 public ByteArrayRequestEntity(byte[] content) { 55 this(content, null); 56 } 57 58 63 public ByteArrayRequestEntity(byte[] content, String contentType) { 64 super(); 65 if (content == null) { 66 throw new IllegalArgumentException ("The content cannot be null"); 67 } 68 this.content = content; 69 this.contentType = contentType; 70 } 71 72 75 public boolean isRepeatable() { 76 return true; 77 } 78 79 82 public String getContentType() { 83 return contentType; 84 } 85 86 89 public void writeRequest(OutputStream out) throws IOException { 90 out.write(content); 91 } 92 93 96 public long getContentLength() { 97 return content.length; 98 } 99 100 103 public byte[] getContent() { 104 return content; 105 } 106 107 } 108
| Popular Tags
|