001    package org.crsh.vfs.spi.ram;
002    
003    import java.io.ByteArrayInputStream;
004    import java.io.IOException;
005    import java.io.InputStream;
006    import java.net.URL;
007    import java.net.URLConnection;
008    
009    /** @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a> */
010    public class RAMURLConnection extends URLConnection {
011    
012      /** . */
013      private final String file;
014    
015      public RAMURLConnection(URL url, String file) {
016        super(url);
017    
018        //
019        this.file = file;
020      }
021    
022      @Override
023      public void connect() throws IOException {
024      }
025    
026      @Override
027      public InputStream getInputStream() throws IOException{
028        return new ByteArrayInputStream(file.getBytes());
029      }
030    }