Search in sources :

Example 6 with StaticByteBuffer

use of com.thinkaurelius.titan.diskstorage.util.StaticByteBuffer in project titan by thinkaurelius.

the class KeyColumnValueStoreUtil method stringToByteBuffer.

// TODO rename as "stringToBuffer" after syntax errors are resolved
public static StaticBuffer stringToByteBuffer(String s) {
    byte[] b;
    try {
        b = s.getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
        throw new RuntimeException(e);
    }
    ByteBuffer bb = ByteBuffer.allocate(b.length);
    bb.put(b);
    bb.flip();
    return new StaticByteBuffer(bb);
}
Also used : StaticByteBuffer(com.thinkaurelius.titan.diskstorage.util.StaticByteBuffer) UnsupportedEncodingException(java.io.UnsupportedEncodingException) StaticByteBuffer(com.thinkaurelius.titan.diskstorage.util.StaticByteBuffer) ByteBuffer(java.nio.ByteBuffer)

Aggregations

StaticByteBuffer (com.thinkaurelius.titan.diskstorage.util.StaticByteBuffer)6 ByteBuffer (java.nio.ByteBuffer)5 StaticBuffer (com.thinkaurelius.titan.diskstorage.StaticBuffer)2 ArrayList (java.util.ArrayList)2 ReadBuffer (com.thinkaurelius.titan.diskstorage.ReadBuffer)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1