Changeset 7060 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Base64.java
r6380 r7060 4 4 import java.nio.ByteBuffer; 5 5 6 /** 7 * This class implements an encoder for encoding byte and character data using the 8 * <a href="https://en.wikipedia.org/wiki/Base64">Base64</a> encoding scheme as specified in 9 * <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a> ("base64", default) and 10 * <a href="http://tools.ietf.org/html/rfc4648#section-4">RFC 4648</a> ("base64url"). 11 * @since 195 12 */ 6 13 public final class Base64 { 14 // TODO: Remove this class when switching to Java 8 (finally integrated in Java SE as java.util.Base64.Encoder) 7 15 8 16 private Base64() { … … 10 18 } 11 19 20 /** "base64": RFC 2045 default encoding */ 12 21 private static String encDefault = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 22 /** "base64url": RFC 4648 url-safe encoding */ 13 23 private static String encUrlSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; 14 24 25 /** 26 * Encodes all characters from the specified string into a new String using the Base64 default encoding scheme. 27 * @param s the string to encode 28 * @return A new string containing the resulting encoded characters. 29 */ 15 30 public static String encode(String s) { 16 31 return encode(s, false); 17 32 } 18 33 34 /** 35 * Encodes all characters from the specified string into a new String using a supported Base64 encoding scheme. 36 * @param s the string to encode 37 * @param urlsafe if {@code true}, uses "base64url" encoding, otherwise use the "base64" default encoding 38 * @return A new string containing the resulting encoded characters. 39 * @since 3840 40 */ 19 41 public static String encode(String s, boolean urlsafe) { 20 42 StringBuilder out = new StringBuilder(); … … 35 57 } 36 58 59 /** 60 * Encodes all remaining bytes from the specified byte buffer into a new string using the Base64 default encoding scheme. 61 * Upon return, the source buffer's position will be updated to its limit; its limit will not have been changed. 62 * @param s the source ByteBuffer to encode 63 * @return A new string containing the resulting encoded characters. 64 */ 37 65 public static String encode(ByteBuffer s) { 38 66 return encode(s, false); 39 67 } 40 68 69 /** 70 * Encodes all remaining bytes from the specified byte buffer into a new string using a supported Base64 encoding scheme. 71 * Upon return, the source buffer's position will be updated to its limit; its limit will not have been changed. 72 * @param s the source ByteBuffer to encode 73 * @param urlsafe if {@code true}, uses "base64url" encoding, otherwise use the "base64" default encoding 74 * @return A new string containing the resulting encoded characters. 75 * @since 3840 76 */ 41 77 public static String encode(ByteBuffer s, boolean urlsafe) { 42 78 StringBuilder out = new StringBuilder(); -
trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
r7037 r7060 216 216 ) { 217 217 gzip.write(debugText.getBytes(Utils.UTF_8)); 218 gzip.finish(); 218 219 219 220 return new URL(Main.getJOSMWebsite()+"/josmticket?" +
Note:
See TracChangeset
for help on using the changeset viewer.