• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 package com.google.android.downloader;
16 
17 import java.util.Set;
18 
19 /** Abstraction of a request engine, which is a high-level interface into a network stack. */
20 public interface UrlEngine {
21   /**
22    * Creates a request for the given URL. The request is returned as a {@link UrlRequest.Builder},
23    * so that callers may further customize the request. Callers must call {@link UrlRequest#send} to
24    * execute the request.
25    *
26    * @param url the URL to connect to. Internal code will assume this is a valid, well-formed URL,
27    *     so client code must have already verified the URL.
28    */
createRequest(String url)29   UrlRequest.Builder createRequest(String url);
30 
31   /**
32    * Returns the set of URL schemes supported by this url request factory instance. Network stacks
33    * that connect over HTTP will likely return the set {"http", "https"}, but there may be many
34    * other types of schemes available (e.g. "file" or "data").
35    */
supportedSchemes()36   Set<String> supportedSchemes();
37 }
38