com.google.api.client.util
Class Strings

java.lang.Object
  extended by com.google.api.client.util.Strings

public class Strings
extends Object

Utilities for strings.

Since:
1.0
Author:
Yaniv Inbar

Field Summary
static String LINE_SEPARATOR
          Line separator to use for this OS, i.e.
static String VERSION
          Current version of the Google API Client Library for Java.
 
Method Summary
static String fromBytesUtf8(byte[] bytes)
          Returns a new String by decoding the specified array of bytes using the "UTF-8" charset.
static byte[] toBytesUtf8(String string)
          Returns a new byte array that is the result of encoding the given string into a sequence of bytes using the "UTF-8" charset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final String VERSION
Current version of the Google API Client Library for Java.

Since:
1.3
See Also:
Constant Field Values

LINE_SEPARATOR

public static final String LINE_SEPARATOR
Line separator to use for this OS, i.e. "\n" or "\r\n".

Method Detail

toBytesUtf8

public static byte[] toBytesUtf8(String string)
Returns a new byte array that is the result of encoding the given string into a sequence of bytes using the "UTF-8" charset.

Parameters:
string - given string
Returns:
resultant byte array
Since:
1.2

fromBytesUtf8

public static String fromBytesUtf8(byte[] bytes)
Returns a new String by decoding the specified array of bytes using the "UTF-8" charset.

The length of the new String is a function of the charset, and hence may not be equal to the length of the byte array.

Parameters:
bytes - bytes to be decoded into characters
Returns:
resultant string
Since:
1.2


Copyright © 2011 Google. All Rights Reserved.