View Javadoc

1   package org.codehaus.classworlds;
2   
3   /*
4    * Copyright 2001-2010 Codehaus Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import java.net.URLConnection;
20  import java.net.URL;
21  import java.io.InputStream;
22  import java.io.ByteArrayInputStream;
23  
24  /**
25   * @author Hani Suleiman (hani@formicary.net)
26   *         <p/>
27   *         Date: Oct 20, 2003
28   *         Time: 12:46:01 AM
29   */
30  @Deprecated
31  public class BytesURLConnection extends URLConnection
32  {
33      protected byte[] content;
34  
35      protected int offset;
36  
37      protected int length;
38  
39      public BytesURLConnection( URL url, byte[] content )
40      {
41          super( url );
42          this.content = content;
43      }
44  
45      public void connect()
46      {
47      }
48  
49      public InputStream getInputStream()
50      {
51          return new ByteArrayInputStream( content );
52      }
53  }