use of com.google.common.io.ByteArrayDataInput in project presto by prestodb.
the class RaptorColumnIdentity method deserialize.
public static RaptorColumnIdentity deserialize(byte[] bytes) {
checkArgument(bytes.length >= Byte.BYTES, "bytes for RaptorColumnIdentity is corrupt");
ByteArrayDataInput input = newDataInput(bytes);
byte version = input.readByte();
if ((version == CURRENT_VERSION) && (bytes.length == SERIALIZED_SIZE)) {
long columnId = input.readLong();
return new RaptorColumnIdentity(columnId);
}
throw new PrestoException(CORRUPT_SERIALIZED_IDENTITY, "RaptorColumnIdentity is corrupt: " + base16().lowerCase().encode(bytes));
}
use of com.google.common.io.ByteArrayDataInput in project presto by prestodb.
the class RaptorTableIdentity method deserialize.
public static RaptorTableIdentity deserialize(byte[] bytes) {
checkArgument(bytes.length >= Byte.BYTES, "bytes for RaptorTableIdentity is corrupt");
ByteArrayDataInput input = newDataInput(bytes);
byte version = input.readByte();
if ((version == CURRENT_VERSION) && (bytes.length == SERIALIZED_SIZE)) {
long tableId = input.readLong();
return new RaptorTableIdentity(tableId);
}
throw new PrestoException(CORRUPT_SERIALIZED_IDENTITY, "RaptorTableIdentity is corrupt: " + base16().lowerCase().encode(bytes));
}
use of com.google.common.io.ByteArrayDataInput in project hbase by apache.
the class Mutation method getClusterIds.
/**
* @return the set of clusterIds that have consumed the mutation
*/
public List<UUID> getClusterIds() {
List<UUID> clusterIds = new ArrayList<>();
byte[] bytes = getAttribute(CONSUMED_CLUSTER_IDS);
if (bytes != null) {
ByteArrayDataInput in = ByteStreams.newDataInput(bytes);
int numClusters = in.readInt();
for (int i = 0; i < numClusters; i++) {
clusterIds.add(new UUID(in.readLong(), in.readLong()));
}
}
return clusterIds;
}
use of com.google.common.io.ByteArrayDataInput in project MinecraftForge by MinecraftForge.
the class ClassPatchManager method readPatch.
private ClassPatch readPatch(JarEntry patchEntry, JarInputStream jis) {
if (DEBUG)
FMLRelaunchLog.finer("Reading patch data from %s", patchEntry.getName());
ByteArrayDataInput input;
try {
input = ByteStreams.newDataInput(ByteStreams.toByteArray(jis));
} catch (IOException e) {
FMLRelaunchLog.log(Level.WARN, e, "Unable to read binpatch file %s - ignoring", patchEntry.getName());
return null;
}
String name = input.readUTF();
String sourceClassName = input.readUTF();
String targetClassName = input.readUTF();
boolean exists = input.readBoolean();
int inputChecksum = 0;
if (exists) {
inputChecksum = input.readInt();
}
int patchLength = input.readInt();
byte[] patchBytes = new byte[patchLength];
input.readFully(patchBytes);
return new ClassPatch(name, sourceClassName, targetClassName, exists, inputChecksum, patchBytes);
}
use of com.google.common.io.ByteArrayDataInput in project drill by apache.
the class HiveSubScan method deserializeInputSplit.
public static InputSplit deserializeInputSplit(String base64, String className) throws IOException, ReflectiveOperationException {
Constructor<?> constructor = Class.forName(className).getDeclaredConstructor();
if (constructor == null) {
throw new ReflectiveOperationException("Class " + className + " does not implement a default constructor.");
}
constructor.setAccessible(true);
InputSplit split = (InputSplit) constructor.newInstance();
ByteArrayDataInput byteArrayDataInput = ByteStreams.newDataInput(Base64.decodeBase64(base64));
split.readFields(byteArrayDataInput);
return split;
}
Aggregations