Methods Summary |
---|
public static D | readFromArray(byte[] data, D d)
if (data == null) throw new IOException("Missing data");
final ByteArrayInputStream in = new ByteArrayInputStream(data);
d.reset();
try {
d.read(new DataInputStream(in));
} catch (IOException e) {
d.reset();
throw e;
}
return d;
|
public static D | readFromArrayOrNull(byte[] data, D d)
try {
return readFromArray(data, d);
} catch (IOException e) {
Log.w(TAG, "Failed to read", e);
return null;
}
|
public static D | readFromParcel(android.os.Parcel parcel, D d)
try {
return readFromArray(parcel.createByteArray(), d);
} catch (IOException e) {
throw new BadParcelableException(e);
}
|
public static java.lang.String | readNullableString(java.io.DataInputStream in)
if (in.read() != 0) {
return in.readUTF();
} else {
return null;
}
|
public static void | writeNullableString(java.io.DataOutputStream out, java.lang.String value)
if (value != null) {
out.write(1);
out.writeUTF(value);
} else {
out.write(0);
}
|
public static byte[] | writeToArray(D d)
final ByteArrayOutputStream out = new ByteArrayOutputStream();
d.write(new DataOutputStream(out));
return out.toByteArray();
|
public static byte[] | writeToArrayOrNull(D d)
try {
return writeToArray(d);
} catch (IOException e) {
Log.w(TAG, "Failed to write", e);
return null;
}
|
public static void | writeToParcel(android.os.Parcel parcel, D d)
try {
parcel.writeByteArray(writeToArray(d));
} catch (IOException e) {
throw new BadParcelableException(e);
}
|