本文整理了Java中com.google.appengine.api.datastore.Blob.getBytes()
方法的一些代码示例,展示了Blob.getBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Blob.getBytes()
方法的具体详情如下:
包路径:com.google.appengine.api.datastore.Blob
类名称:Blob
方法名:getBytes
暂无
代码示例来源:origin: bedatadriven/activityinfo
public static int length(Blob valueArray, int elementSize) {
if(valueArray == null) {
return 0;
}
return valueArray.getBytes().length / elementSize;
}
代码示例来源:origin: bedatadriven/activityinfo
/**
* Returns a view of this array as an {@link IntBuffer}
*/
public static IntBuffer asBuffer(Blob valueArray) {
ByteBuffer buffer = ByteBuffer.wrap(valueArray.getBytes());
buffer.order(ByteOrder.LITTLE_ENDIAN);
return buffer.asIntBuffer();
}
代码示例来源:origin: bedatadriven/activityinfo
/**
* Returns a view of this array as an {@link DoubleBuffer}
*/
public static DoubleBuffer asBuffer(Blob valueArray) {
ByteBuffer buffer = ByteBuffer.wrap(valueArray.getBytes());
buffer.order(ByteOrder.LITTLE_ENDIAN);
return buffer.asDoubleBuffer();
}
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
public FanoutTaskRecord(Entity entity) {
super(entity);
Blob payloadBlob = (Blob) entity.getProperty(PAYLOAD_PROPERTY);
payload = payloadBlob.getBytes();
}
代码示例来源:origin: bedatadriven/activityinfo
private static byte[] ensureCapacity(Blob blob, int index) {
int requiredCapacity = byteIndex(index) + 1;
if(blob == null) {
return new byte[requiredCapacity];
}
byte[] bytes = blob.getBytes();
if(requiredCapacity <= bytes.length) {
return bytes;
} else {
return Arrays.copyOf(bytes, requiredCapacity);
}
}
代码示例来源:origin: bedatadriven/activityinfo
public static String[] toArray(Blob blob) {
if(blob == null) {
return EMPTY_STRING_ARRAY;
} else {
return toArray(blob.getBytes());
}
}
代码示例来源:origin: bedatadriven/activityinfo
public static int get(Blob blob, int index) {
if(blob == null) {
return MISSING;
} else {
return get(blob.getBytes(), index);
}
}
代码示例来源:origin: bedatadriven/activityinfo
public static int length(Blob values) {
if(values == null) {
return 0;
} else {
return length(values.getBytes());
}
}
代码示例来源:origin: bedatadriven/activityinfo
public static byte[] read(PropertyContainer entity, String propertyName) {
Blob blob = (Blob) entity.getProperty(propertyName);
if(blob == null) {
return EMPTY;
} else {
return blob.getBytes();
}
}
代码示例来源:origin: bedatadriven/activityinfo
public static void toArray(Blob blob, String[] array, int offset) {
if(blob != null) {
toArray(blob.getBytes(), array, offset);
}
}
代码示例来源:origin: bedatadriven/activityinfo
public static int size(Blob pool) {
if(pool == null) {
return 0;
}
return size(pool.getBytes());
}
代码示例来源:origin: bedatadriven/activityinfo
/**
* Retrieves the one-based offset from the blob. Zero if the offset is missing.
*/
public static int get(Blob blob, int index) {
if(blob == null) {
return 0;
} else {
return get(blob.getBytes(), index);
}
}
代码示例来源:origin: bedatadriven/activityinfo
public static ByteBuffer asBuffer(Blob valueArray) {
return asBuffer(valueArray.getBytes());
}
代码示例来源:origin: com.google.http-client/google-http-client-appengine
/** Deserializes the specified object from a Blob using an {@link ObjectInputStream}. */
private V deserialize(Entity entity) throws IOException {
Blob blob = (Blob) entity.getProperty(FIELD_VALUE);
return IOUtils.deserialize(blob.getBytes());
}
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
public ShardedValue(Entity entity) {
super(entity);
this.shardId = (Long) entity.getProperty(SHARD_ID_PROPERTY);
this.value = ((Blob) entity.getProperty(VALUE_PROPERTY)).getBytes();
}
代码示例来源:origin: com.google.appengine.tools/appengine-pipeline
public ExceptionRecord(Entity entity) {
super(entity);
Blob serializedExceptionBlob = (Blob) entity.getProperty(EXCEPTION_PROPERTY);
byte[] serializedException = serializedExceptionBlob.getBytes();
try {
exception = (Throwable) SerializationUtils.deserialize(serializedException);
} catch (IOException e) {
throw new RuntimeException("Failed to deserialize exception for " + getKey(), e);
}
}
代码示例来源:origin: org.vesalainen.dsql/dsql
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
{
columnName = table.getColumnName(column);
if (value != null)
{
Blob blob = (Blob) value;
dialog.setBytes(blob.getBytes());
button.setText(dialog.getContentDescription());
}
else
{
button.setText(null);
}
return button;
}
代码示例来源:origin: bedatadriven/activityinfo
public static Blob appendString(Blob stringPool, String string) {
if(stringPool == null) {
return new Blob(newPool(string));
} else {
return new Blob(appendString(stringPool.getBytes(), string.getBytes(Charsets.UTF_8)));
}
}
代码示例来源:origin: com.googlecode.cedar-common/objectify
public static void serialize(SerializationStreamWriter streamWriter, Blob instance)
throws SerializationException
{
byte[] bytes = instance.getBytes();
if (bytes == null) {
streamWriter.writeInt(-1);
} else {
streamWriter.writeInt(bytes.length);
for (byte b : bytes)
{
streamWriter.writeByte(b);
}
}
}
}
代码示例来源:origin: GoogleCloudPlatform/appengine-tck
@Test
public void testBlobType() {
String propertyName = "blobProp";
List<Entity> elist = doQuery(kindName, propertyName, null, false);
Blob blob = (Blob) elist.get(0).getProperty(propertyName);
Blob sameDat = (Blob) elist.get(0).getProperty(propertyName);
Blob diffDat = (Blob) elist.get(1).getProperty(propertyName);
assertTrue(blob.equals(sameDat));
assertFalse(blob.equals(diffDat));
byte[] blobData = blob.getBytes();
assertTrue(Arrays.equals("blobImage".getBytes(), blobData) ||
Arrays.equals("blobText".getBytes(), blobData) ||
Arrays.equals("blobData".getBytes(), blobData));
assertEquals(blob.hashCode(), blob.hashCode());
}
内容来源于网络,如有侵权,请联系作者删除!