- Timestamp:
- 2015-12-26T23:41:57+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/Compression.java
r9169 r9170 108 108 * 109 109 * @throws IOException if any I/O error occurs 110 * @deprecated Use {@link org.openstreetmap.josm.tools.HttpClient} instead 110 111 */ 112 @Deprecated 111 113 public static InputStream getUncompressedURLInputStream(URL url) throws IOException { 112 114 return Utils.openURLAndDecompress(url, true); -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r9072 r9170 765 765 * @throws java.io.IOException if an I/O exception occurs. 766 766 * @since 5587 767 */ 767 * @deprecated Use {@link HttpClient} instead 768 */ 769 @Deprecated 768 770 public static HttpURLConnection openHttpConnection(URL httpURL) throws IOException { 769 771 if (httpURL == null || !HTTP_PREFFIX_PATTERN.matcher(httpURL.getProtocol()).matches()) { … … 785 787 * @throws java.io.IOException if an I/O exception occurs. 786 788 * @since 5867 787 */ 789 * @deprecated Use {@link HttpClient} instead 790 */ 791 @Deprecated 788 792 public static InputStream openURL(URL url) throws IOException { 789 return openURLAndDecompress(url, false);793 return HttpClient.create(url).connect().getContent(); 790 794 } 791 795 … … 798 802 * @throws IOException if an I/O exception occurs. 799 803 * @since 6421 800 */ 804 * @deprecated Use {@link HttpClient} instead 805 */ 806 @Deprecated 801 807 public static InputStream openURLAndDecompress(final URL url, final boolean decompress) throws IOException { 802 final URLConnection connection = setupURLConnection(url.openConnection()); 803 final InputStream in = connection.getInputStream(); 804 if (decompress) { 805 switch (connection.getHeaderField("Content-Type")) { 806 case "application/zip": 807 return getZipInputStream(in); 808 case "application/x-gzip": 809 return getGZipInputStream(in); 810 case "application/x-bzip2": 811 return getBZip2InputStream(in); 812 } 813 } 814 return in; 808 return HttpClient.create(url).connect().uncompress(decompress).getContent(); 815 809 } 816 810 … … 868 862 * @return {@code connection}, with updated properties 869 863 * @since 5887 870 */ 864 * @deprecated Use {@link HttpClient} instead 865 */ 866 @Deprecated 871 867 public static URLConnection setupURLConnection(URLConnection connection) { 872 868 if (connection != null) { … … 884 880 * @throws java.io.IOException if an I/O exception occurs. 885 881 * @since 5868 886 */ 882 * @deprecated Use {@link HttpClient} instead 883 */ 884 @Deprecated 887 885 public static BufferedReader openURLReader(URL url) throws IOException { 888 return openURLReaderAndDecompress(url, false);886 return HttpClient.create(url).connect().getContentReader(); 889 887 } 890 888 … … 897 895 * @throws IOException if an I/O exception occurs. 898 896 * @since 6421 899 */ 897 * @deprecated Use {@link HttpClient} instead 898 */ 899 @Deprecated 900 900 public static BufferedReader openURLReaderAndDecompress(final URL url, final boolean decompress) throws IOException { 901 return new BufferedReader(new InputStreamReader(openURLAndDecompress(url, decompress), StandardCharsets.UTF_8));901 return HttpClient.create(url).connect().uncompress(decompress).getContentReader(); 902 902 } 903 903 … … 909 909 * @throws java.io.IOException if an I/O exception occurs. 910 910 * @since 5587 911 */ 911 * @deprecated Use {@link HttpClient} instead 912 */ 913 @Deprecated 912 914 public static HttpURLConnection openHttpConnection(URL httpURL, boolean keepAlive) throws IOException { 913 915 HttpURLConnection connection = openHttpConnection(httpURL); … … 935 937 * @throws IOException if an I/O exception occurs 936 938 * @since 8650 937 */ 939 * @deprecated Use {@link HttpClient} instead 940 */ 941 @Deprecated 938 942 public static HttpURLConnection openHttpConnection(URL httpURL, boolean keepAlive, boolean followRedirects) throws IOException { 939 943 HttpURLConnection connection = openHttpConnection(httpURL, keepAlive);
Note:
See TracChangeset
for help on using the changeset viewer.