Example usage for java.io ObjectInput read

List of usage examples for java.io ObjectInput read

Introduction

In this page you can find the example usage for java.io ObjectInput read.

Prototype

public int read(byte b[]) throws IOException;

Source Link

Document

Reads into an array of bytes.

Usage

From source file:com.delphix.session.impl.frame.SessionHandle.java

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    handle = new byte[in.readInt()];
    in.read(handle);
}

From source file:org.apache.rahas.Token.java

/**
 * Implementing de-serialization logic in accordance with the serialization logic.
 * @param in Stream which used to read data.
 * @throws IOException If unable to de-serialize particular data member.
 * @throws ClassNotFoundException //  w  w w  .ja v a  2s.c o m
 */
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {

    this.id = (String) in.readObject();

    this.state = in.readInt();

    String stringElement = (String) in.readObject();
    this.token = convertStringToOMElement(stringElement);

    stringElement = (String) in.readObject();
    this.previousToken = convertStringToOMElement(stringElement);

    stringElement = (String) in.readObject();
    this.attachedReference = convertStringToOMElement(stringElement);

    stringElement = (String) in.readObject();
    this.unattachedReference = convertStringToOMElement(stringElement);

    this.properties = (Properties) in.readObject();

    this.changed = in.readBoolean();

    // Read the length of the secret
    int secretLength = in.readInt();

    if (0 != secretLength) {
        byte[] buffer = new byte[secretLength];
        if (secretLength != in.read(buffer)) {
            throw new IllegalStateException("Bytes read from the secret key is not equal to serialized length");
        }
        this.secret = buffer;
    } else {
        this.secret = null;
    }

    this.created = (Date) in.readObject();

    this.expires = (Date) in.readObject();

    this.issuerAddress = (String) in.readObject();

    this.encrKeySha1Value = (String) in.readObject();
}

From source file:org.codehaus.wadi.core.session.LazyAttributes.java

public synchronized void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException {
    int length = oi.readInt();
    bytes = new byte[length];
    if (oi.read(bytes) != length) {
        throw new IOException("data truncated whilst reading Session Attributes- data lost");
    }//from   w ww.j a  v a 2s  . c  om
}

From source file:org.codehaus.wadi.core.session.LazyValue.java

public synchronized void readExternal(ObjectInput oi) throws IOException, ClassNotFoundException {
    int length = oi.readInt();
    bytes = new byte[length];
    if (oi.read(bytes) != length) {
        throw new IOException("data truncated whilst reading Session attribute value - data lost");
    }//from ww  w .j  a  v a  2s .c om
}