FileDocCategorySizeDatePackage
DurableUtils.javaAPI DocAndroid 5.1 API3131Thu Mar 12 22:22:40 GMT 2015com.android.documentsui.model

DurableUtils

public class DurableUtils extends Object

Fields Summary
Constructors Summary
Methods Summary
public static DreadFromArray(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 DreadFromArrayOrNull(byte[] data, D d)

        try {
            return readFromArray(data, d);
        } catch (IOException e) {
            Log.w(TAG, "Failed to read", e);
            return null;
        }
    
public static DreadFromParcel(android.os.Parcel parcel, D d)

        try {
            return readFromArray(parcel.createByteArray(), d);
        } catch (IOException e) {
            throw new BadParcelableException(e);
        }
    
public static java.lang.StringreadNullableString(java.io.DataInputStream in)

        if (in.read() != 0) {
            return in.readUTF();
        } else {
            return null;
        }
    
public static voidwriteNullableString(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 voidwriteToParcel(android.os.Parcel parcel, D d)

        try {
            parcel.writeByteArray(writeToArray(d));
        } catch (IOException e) {
            throw new BadParcelableException(e);
        }