1 package net.krecan.m2_proxy; 2 3 import java.io.IOException; 4 import java.io.OutputStream; 5 6 /*** 7 * Resource abstraction. 8 * @author Lukas Krecan 9 * 10 */ 11 public interface Resource { 12 /*** 13 * Returns length of the resource 14 * @return 15 */ 16 public long getLength(); 17 18 /*** 19 * Copies the resource to the output stream. You can call this method only once. 20 * It means, you can not recycle a resource. After copying, you have to release the resource. 21 * @param outputStream 22 * @throws IOException 23 */ 24 public void copyToStream(OutputStream outputStream) throws IOException; 25 26 /*** 27 * Releases all system resources blocked by this resource :-) It HAS to be called after using the resource. 28 * 29 */ 30 public void release(); 31 32 /*** 33 * Returns last modification date. 34 * @return 35 */ 36 public long getLastModified(); 37 38 /*** 39 * Returns path to the resource. LogicalName == resourcePath 40 * @return 41 */ 42 public String getLogicalName(); 43 }