Ignore:
Timestamp:
2015-03-10T01:17:39+01:00 (10 years ago)
Author:
Don-vip
Message:

fix #11162 - update to metadata-extractor 2.7.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/src/com/drew/lang/StringUtil.java

    r6127 r8132  
    11/*
    2  * Copyright 2002-2012 Drew Noakes
     2 * Copyright 2002-2015 Drew Noakes
    33 *
    44 *    Licensed under the Apache License, Version 2.0 (the "License");
     
    1616 * More information about this project is available at:
    1717 *
    18  *    http://drewnoakes.com/code/exif/
    19  *    http://code.google.com/p/metadata-extractor/
     18 *    https://drewnoakes.com/code/exif/
     19 *    https://github.com/drewnoakes/metadata-extractor
    2020 */
    2121
     
    2323
    2424import com.drew.lang.annotations.NotNull;
     25import com.drew.lang.annotations.Nullable;
    2526
     27import java.io.BufferedReader;
     28import java.io.IOException;
     29import java.io.InputStream;
     30import java.io.InputStreamReader;
    2631import java.util.Iterator;
    2732
    28 /** @author Drew Noakes http://drewnoakes.com */
     33/**
     34 * @author Drew Noakes https://drewnoakes.com
     35 */
    2936public class StringUtil
    3037{
     38    @NotNull
    3139    public static String join(@NotNull Iterable<? extends CharSequence> strings, @NotNull String delimiter)
    3240    {
     
    5058    }
    5159
     60    @NotNull
    5261    public static <T extends CharSequence> String join(@NotNull T[] strings, @NotNull String delimiter)
    5362    {
     
    6978        return buffer.toString();
    7079    }
     80
     81    @NotNull
     82    public static String fromStream(@NotNull InputStream stream) throws IOException
     83    {
     84        BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
     85        StringBuilder sb = new StringBuilder();
     86        String line;
     87        while ((line = reader.readLine()) != null) {
     88            sb.append(line);
     89        }
     90        return sb.toString();
     91    }
     92
     93    public static int compare(@Nullable String s1, @Nullable String s2)
     94    {
     95        boolean null1 = s1 == null;
     96        boolean null2 = s2 == null;
     97
     98        if (null1 && null2) {
     99            return 0;
     100        } else if (null1) {
     101            return -1;
     102        } else if (null2) {
     103            return 1;
     104        } else {
     105            return s1.compareTo(s2);
     106        }
     107    }
     108
     109    @NotNull
     110    public static String urlEncode(@NotNull String name)
     111    {
     112        // Sufficient for now, it seems
     113        return name.replace(" ", "%20");
     114    }
    71115}
Note: See TracChangeset for help on using the changeset viewer.