My favorites
▼
|
Sign in
pelops
A Java client library for the Cassandra database
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
src
/
org
/
wyki
/
cassandra
/
pelops
/
StringHelper.java
r7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package org.wyki.cassandra.pelops;
import java.io.UnsupportedEncodingException;
public class StringHelper {
/**
* Create an array of bytes that represents a <code>String</code> using UTF-8 encoding.
* @param string The <code>String</code> to convert
* @return The string as UTF-8 bytes
*/
public static byte[] toBytes(String string) {
try {
return string.getBytes("utf-8");
} catch (UnsupportedEncodingException e) {
assert false;
e.printStackTrace();
return new byte[] {};
}
}
/**
* Create a <code>String</code> from an array of UTF-8 bytes
* @param bytes The array of UTF-8 bytes
* @return The <code>String</code> object
* @throws UnsupportedEncodingException Thrown if the bytes are not represent an UTF-8 encoding
*/
public static String toUTF8(byte[] bytes) throws UnsupportedEncodingException {
if (bytes == null)
return null;
return new String(bytes, "utf-8");
}
}
Show details
Hide details
Change log
r2
by thedwilliams on Jun 8, 2010
Diff
[No log message]
Go to:
/trunk/build
/trunk/build/pelops.jar
/trunk/lib
...k/lib/apache-cassandra-0.6.0.jar
/trunk/lib/libthrift-r917130.jar
/trunk/lib/slf4j-api-1.5.10.jar
/trunk/lib/uuid-3.2-sources.jar
/trunk/lib/uuid-3.2.jar
/trunk/src
/trunk/src/org
/trunk/src/org/wyki
/trunk/src/org/wyki/cassandra
...nk/src/org/wyki/cassandra/pelops
...cassandra/pelops/IOperation.java
...cassandra/pelops/KeyDeletor.java
...ndra/pelops/KeyspaceOperand.java
...ki/cassandra/pelops/Metrics.java
...ki/cassandra/pelops/Mutator.java
...ssandra/pelops/NumberHelper.java
...ki/cassandra/pelops/Operand.java
...yki/cassandra/pelops/Pelops.java
...yki/cassandra/pelops/Policy.java
...i/cassandra/pelops/Selector.java
...ssandra/pelops/StringHelper.java
...cassandra/pelops/ThriftPool.java
...cassandra/pelops/UuidHelper.java
/trunk/src/org/wyki/concurrency
.../concurrency/AutoResetEvent.java
...yki/concurrency/IResetEvent.java
...oncurrency/ManualResetEvent.java
/trunk/src/org/wyki/networking
.../src/org/wyki/networking/utility
...g/utility/NetworkAlgorithms.java
/trunk/src/org/wyki/portability
.../portability/ILoggerFactory.java
...yki/portability/SystemProxy.java
Project members,
sign in
to write a code review
Older revisions
All revisions of this file
File info
Size: 952 bytes, 33 lines
View raw file
Powered by
Google Project Hosting