1 package eu
.alefzero
.webdav
; 
   4 import java
.io
.FileInputStream
; 
   5 import java
.io
.IOException
; 
   6 import java
.io
.InputStream
; 
   7 import java
.io
.OutputStream
; 
   9 import org
.apache
.commons
.httpclient
.methods
.RequestEntity
; 
  12  * A RequestEntity that represents a File. 
  15 public class FileRequestEntity 
implements RequestEntity 
{ 
  18     final String contentType
; 
  20     public FileRequestEntity(final File file
, final String contentType
) { 
  23             throw new IllegalArgumentException("File may not be null"); 
  26         this.contentType 
= contentType
; 
  29     public long getContentLength() { 
  30         return this.file
.length(); 
  33     public String 
getContentType() { 
  34         return this.contentType
; 
  37     public boolean isRepeatable() { 
  41     public void writeRequest(final OutputStream out
) throws IOException 
{ 
  42         byte[] tmp 
= new byte[4096]; 
  44         InputStream instream 
= new FileInputStream(this.file
); 
  46             while ((i 
= instream
.read(tmp
)) >= 0) {