Loading api/current.xml +2 −2 Original line number Diff line number Diff line Loading @@ -190640,10 +190640,10 @@ synchronized="false" static="true" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > <parameter name="addr" type="int"> <parameter name="ipv4Address" type="int"> </parameter> </method> <method name="formatShortFileSize" core/java/android/net/NetworkUtils.java +4 −9 Original line number Diff line number Diff line Loading @@ -125,24 +125,19 @@ public class NetworkUtils { /** * Convert a IPv4 address from an integer to an InetAddress. * @param hostAddr is an Int corresponding to the IPv4 address in network byte order * @return the IP address as an {@code InetAddress}, returns null if * unable to convert or if the int is an invalid address. * @param hostAddress an int corresponding to the IPv4 address in network byte order */ public static InetAddress intToInetAddress(int hostAddress) { InetAddress inetAddress; byte[] addressBytes = { (byte)(0xff & hostAddress), (byte)(0xff & (hostAddress >> 8)), (byte)(0xff & (hostAddress >> 16)), (byte)(0xff & (hostAddress >> 24)) }; try { inetAddress = InetAddress.getByAddress(addressBytes); return InetAddress.getByAddress(addressBytes); } catch (UnknownHostException e) { return null; throw new AssertionError(); } return inetAddress; } /** Loading core/java/android/text/format/Formatter.java +18 −17 Original line number Diff line number Diff line Loading @@ -17,10 +17,11 @@ package android.text.format; import android.content.Context; import android.net.NetworkUtils; /** * Utility class to aid in formatting common values that are not covered * by the standard java.util.Formatter. * by {@link java.util.Formatter} */ public final class Formatter { Loading @@ -28,8 +29,8 @@ public final class Formatter { * Formats a content size to be in the form of bytes, kilobytes, megabytes, etc * * @param context Context to use to load the localized units * @param number size value to be formated * @return formated string with the number * @param number size value to be formatted * @return formatted string with the number */ public static String formatFileSize(Context context, long number) { return formatFileSize(context, number, false); Loading @@ -37,7 +38,7 @@ public final class Formatter { /** * Like {@link #formatFileSize}, but trying to generate shorter numbers * (showing fewer digits of precisin). * (showing fewer digits of precision). */ public static String formatShortFileSize(Context context, long number) { return formatFileSize(context, number, true); Loading Loading @@ -98,15 +99,15 @@ public final class Formatter { * the IP address. The IP address is expected to be in little-endian format (LSB first). That * is, 0x01020304 will return "4.3.2.1". * * @param addr the IP address as a packed integer with LSB first. * @param ipv4Address the IP address as a packed integer with LSB first. * @return string with canonical IP address format. * * @deprecated this method doesn't support IPv6 addresses. Prefer {@link * java.net.InetAddress#getHostAddress()}, which supports both IPv4 and * IPv6 addresses. */ public static String formatIpAddress(int addr) { StringBuffer buf = new StringBuffer(); buf.append(addr & 0xff).append('.'). append((addr >>>= 8) & 0xff).append('.'). append((addr >>>= 8) & 0xff).append('.'). append((addr >>>= 8) & 0xff); return buf.toString(); @Deprecated public static String formatIpAddress(int ipv4Address) { return NetworkUtils.intToInetAddress(ipv4Address).getHostAddress(); } } Loading
api/current.xml +2 −2 Original line number Diff line number Diff line Loading @@ -190640,10 +190640,10 @@ synchronized="false" static="true" final="false" deprecated="not deprecated" deprecated="deprecated" visibility="public" > <parameter name="addr" type="int"> <parameter name="ipv4Address" type="int"> </parameter> </method> <method name="formatShortFileSize"
core/java/android/net/NetworkUtils.java +4 −9 Original line number Diff line number Diff line Loading @@ -125,24 +125,19 @@ public class NetworkUtils { /** * Convert a IPv4 address from an integer to an InetAddress. * @param hostAddr is an Int corresponding to the IPv4 address in network byte order * @return the IP address as an {@code InetAddress}, returns null if * unable to convert or if the int is an invalid address. * @param hostAddress an int corresponding to the IPv4 address in network byte order */ public static InetAddress intToInetAddress(int hostAddress) { InetAddress inetAddress; byte[] addressBytes = { (byte)(0xff & hostAddress), (byte)(0xff & (hostAddress >> 8)), (byte)(0xff & (hostAddress >> 16)), (byte)(0xff & (hostAddress >> 24)) }; try { inetAddress = InetAddress.getByAddress(addressBytes); return InetAddress.getByAddress(addressBytes); } catch (UnknownHostException e) { return null; throw new AssertionError(); } return inetAddress; } /** Loading
core/java/android/text/format/Formatter.java +18 −17 Original line number Diff line number Diff line Loading @@ -17,10 +17,11 @@ package android.text.format; import android.content.Context; import android.net.NetworkUtils; /** * Utility class to aid in formatting common values that are not covered * by the standard java.util.Formatter. * by {@link java.util.Formatter} */ public final class Formatter { Loading @@ -28,8 +29,8 @@ public final class Formatter { * Formats a content size to be in the form of bytes, kilobytes, megabytes, etc * * @param context Context to use to load the localized units * @param number size value to be formated * @return formated string with the number * @param number size value to be formatted * @return formatted string with the number */ public static String formatFileSize(Context context, long number) { return formatFileSize(context, number, false); Loading @@ -37,7 +38,7 @@ public final class Formatter { /** * Like {@link #formatFileSize}, but trying to generate shorter numbers * (showing fewer digits of precisin). * (showing fewer digits of precision). */ public static String formatShortFileSize(Context context, long number) { return formatFileSize(context, number, true); Loading Loading @@ -98,15 +99,15 @@ public final class Formatter { * the IP address. The IP address is expected to be in little-endian format (LSB first). That * is, 0x01020304 will return "4.3.2.1". * * @param addr the IP address as a packed integer with LSB first. * @param ipv4Address the IP address as a packed integer with LSB first. * @return string with canonical IP address format. * * @deprecated this method doesn't support IPv6 addresses. Prefer {@link * java.net.InetAddress#getHostAddress()}, which supports both IPv4 and * IPv6 addresses. */ public static String formatIpAddress(int addr) { StringBuffer buf = new StringBuffer(); buf.append(addr & 0xff).append('.'). append((addr >>>= 8) & 0xff).append('.'). append((addr >>>= 8) & 0xff).append('.'). append((addr >>>= 8) & 0xff); return buf.toString(); @Deprecated public static String formatIpAddress(int ipv4Address) { return NetworkUtils.intToInetAddress(ipv4Address).getHostAddress(); } }