Changeset 6823 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2014-02-07T01:34:02+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r6806 r6823 41 41 import java.util.List; 42 42 import java.util.regex.Matcher; 43 import java.util.regex.Pattern; 43 44 import java.util.zip.GZIPInputStream; 44 45 import java.util.zip.ZipFile; … … 53 54 */ 54 55 public final class Utils { 56 57 public static final Pattern WHITE_SPACES_PATTERN = Pattern.compile("\\s+"); 55 58 56 59 private Utils() { … … 318 321 * @param in The source file 319 322 * @param out The destination file 320 * @throws IOException If any I/O error occurs323 * @throws java.io.IOException If any I/O error occurs 321 324 */ 322 325 public static void copyFile(File in, File out) throws IOException { … … 365 368 366 369 /** 367 * <p>Utility method for closing a {@link Closeable} object.</p>370 * <p>Utility method for closing a {@link java.io.Closeable} object.</p> 368 371 * 369 372 * @param c the closeable object. May be null. … … 379 382 380 383 /** 381 * <p>Utility method for closing a {@link ZipFile}.</p>384 * <p>Utility method for closing a {@link java.util.zip.ZipFile}.</p> 382 385 * 383 386 * @param zip the zip file. May be null. … … 577 580 /** 578 581 * Transforms the collection {@code c} into an unmodifiable collection and 579 * applies the {@link Function} {@code f} on each element upon access.582 * applies the {@link org.openstreetmap.josm.tools.Utils.Function} {@code f} on each element upon access. 580 583 * @param <A> class of input collection 581 584 * @param <B> class of transformed collection … … 619 622 /** 620 623 * Transforms the list {@code l} into an unmodifiable list and 621 * applies the {@link Function} {@code f} on each element upon access.624 * applies the {@link org.openstreetmap.josm.tools.Utils.Function} {@code f} on each element upon access. 622 625 * @param <A> class of input collection 623 626 * @param <B> class of transformed collection … … 644 647 } 645 648 649 private static final Pattern HTTP_PREFFIX_PATTERN = Pattern.compile("https?"); 650 646 651 /** 647 652 * Opens a HTTP connection to the given URL and sets the User-Agent property to JOSM's one. 648 653 * @param httpURL The HTTP url to open (must use http:// or https://) 649 654 * @return An open HTTP connection to the given URL 650 * @throws IOException if an I/O exception occurs.655 * @throws java.io.IOException if an I/O exception occurs. 651 656 * @since 5587 652 657 */ 653 658 public static HttpURLConnection openHttpConnection(URL httpURL) throws IOException { 654 if (httpURL == null || ! httpURL.getProtocol().matches("https?")) {659 if (httpURL == null || !HTTP_PREFFIX_PATTERN.matcher(httpURL.getProtocol()).matches()) { 655 660 throw new IllegalArgumentException("Invalid HTTP url"); 656 661 } … … 665 670 * @param url The url to open 666 671 * @return An stream for the given URL 667 * @throws IOException if an I/O exception occurs.672 * @throws java.io.IOException if an I/O exception occurs. 668 673 * @since 5867 669 674 */ … … 711 716 * @param url The url to open 712 717 * @return An buffered stream reader for the given URL (using UTF-8) 713 * @throws IOException if an I/O exception occurs.718 * @throws java.io.IOException if an I/O exception occurs. 714 719 * @since 5868 715 720 */ … … 736 741 * @param keepAlive whether not to set header {@code Connection=close} 737 742 * @return An open HTTP connection to the given URL 738 * @throws IOException if an I/O exception occurs.743 * @throws java.io.IOException if an I/O exception occurs. 739 744 * @since 5587 740 745 */
Note: See TracChangeset
for help on using the changeset viewer.