Java ObjectInput Read Long readLong(ObjectInput in)

Here you can find the source of readLong(ObjectInput in)

Description

read Long

License

Open Source License

Declaration

public static Long readLong(ObjectInput in) throws ClassNotFoundException, IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInput;

public class Main {
    public static final int NULL = 0x00;
    public static final int NOTNULL = 0x01;

    public static Long readLong(ObjectInput in) throws ClassNotFoundException, IOException {
        byte b = in.readByte();
        switch (b) {
        case NULL:
            return null;
        case NOTNULL:
            return in.readLong();
        }/*from  www  .j  a v  a 2 s  . co m*/
        throw new InvalidObjectException("null flag broken:" + b);
    }

    public static Byte readByte(ObjectInput in) throws ClassNotFoundException, IOException {
        byte b = in.readByte();
        switch (b) {
        case NULL:
            return null;
        case NOTNULL:
            return in.readByte();
        }
        throw new InvalidObjectException("null flag broken:" + b);

    }
}

Related

  1. readLong(ObjectInput in)