FileDocCategorySizeDatePackage
OutputStorage.javaAPI DocJ2ME MIDP 2.01913Thu Nov 07 12:02:38 GMT 2002com.sun.midp.mekeytool

OutputStorage

public class OutputStorage extends com.sun.midp.publickeystore.Storage
Write fields to an OutputStream.

Fields Summary
private DataOutputStream
out
stream to write to
Constructors Summary
OutputStorage(OutputStream output)
Constructs an OutputStorage for an OutputStream.

param
output the output storage output stream.
exception
IOException if the storage version cannot be written

        out = new DataOutputStream(output);

        out.writeByte(CURRENT_VERSION);
    
Methods Summary
voidwriteValue(byte tag, byte[] value)
Stores a byte array field as tag, BINARY_TYPE, value.

param
tag number to unique to this field
param
value value of field

        out.writeByte(tag);
        out.writeByte(BINARY_TYPE);

        /*
         * must write our own length, because DataOutputStream does not handle
         * handle byte arrays.
         */
        out.writeShort(value.length);
        out.write(value);
    
voidwriteValue(byte tag, java.lang.String value)
Stores a String field as tag, STRING_TYPE, value.

param
tag number to unique to this field
param
value value of field

        out.writeByte(tag);
        out.writeByte(STRING_TYPE);
        out.writeUTF(value);
    
voidwriteValue(byte tag, long value)
Stores a long field as tag, LONG_TYPE, value.

param
tag number to unique to this field
param
value value of field

        out.writeByte(tag);
        out.writeByte(LONG_TYPE);
        out.writeLong(value);