1 31 32 package org.apache.commons.httpclient.methods.multipart; 33 34 import java.io.ByteArrayInputStream ; 35 import java.io.IOException ; 36 import java.io.InputStream ; 37 38 46 public class ByteArrayPartSource implements PartSource { 47 48 49 private String fileName; 50 51 52 private byte[] bytes; 53 54 60 public ByteArrayPartSource(String fileName, byte[] bytes) { 61 62 this.fileName = fileName; 63 this.bytes = bytes; 64 65 } 66 67 70 public long getLength() { 71 return bytes.length; 72 } 73 74 77 public String getFileName() { 78 return fileName; 79 } 80 81 84 public InputStream createInputStream() throws IOException { 85 return new ByteArrayInputStream (bytes); 86 } 87 88 } 89 | Popular Tags |