1 17 18 package org.apache.naming.resources; 19 20 import java.io.InputStream ; 21 import java.io.ByteArrayInputStream ; 22 import java.io.IOException ; 23 24 30 public class Resource { 31 32 33 35 36 public Resource() { 37 } 38 39 40 public Resource(InputStream inputStream) { 41 setContent(inputStream); 42 } 43 44 45 public Resource(byte[] binaryContent) { 46 setContent(binaryContent); 47 } 48 49 50 52 53 56 protected byte[] binaryContent = null; 57 58 59 62 protected InputStream inputStream = null; 63 64 65 67 68 73 public InputStream streamContent() 74 throws IOException { 75 if (binaryContent != null) { 76 return new ByteArrayInputStream (binaryContent); 77 } 78 return inputStream; 79 } 80 81 82 87 public byte[] getContent() { 88 return binaryContent; 89 } 90 91 92 97 public void setContent(InputStream inputStream) { 98 this.inputStream = inputStream; 99 } 100 101 102 107 public void setContent(byte[] binaryContent) { 108 this.binaryContent = binaryContent; 109 } 110 111 112 } 113 | Popular Tags |