View Javadoc

1   package com.atlassian.plugin.classloader.url;
2   
3   import java.net.URL;
4   import java.net.URLConnection;
5   import java.io.InputStream;
6   import java.io.ByteArrayInputStream;
7   
8   /**
9    * URL connection from a byte array
10   */
11  public class BytesUrlConnection extends URLConnection
12  {
13      private final byte[] content;
14  
15      public BytesUrlConnection(URL url, byte[] content)
16      {
17          super(url);
18          this.content = content;
19      }
20  
21      public void connect()
22      {
23      }
24  
25      public InputStream getInputStream()
26      {
27          return new ByteArrayInputStream(content);
28      }
29  }