All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hprose.io.unserialize.AtomicReferenceArrayUnserializer Maven / Gradle / Ivy

/**********************************************************\
|                                                          |
|                          hprose                          |
|                                                          |
| Official WebSite: http://www.hprose.com/                 |
|                   http://www.hprose.org/                 |
|                                                          |
\**********************************************************/
/**********************************************************\
 *                                                        *
 * AtomicReferenceArrayUnserializer.java                  *
 *                                                        *
 * AtomicReferenceArray unserializer class for Java.      *
 *                                                        *
 * LastModified: Aug 4, 2016                              *
 * Author: Ma Bingyao                   *
 *                                                        *
\**********************************************************/

package hprose.io.unserialize;

import static hprose.io.HproseTags.TagNull;
import hprose.util.ClassUtil;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.concurrent.atomic.AtomicReferenceArray;

public final class AtomicReferenceArrayUnserializer implements Unserializer {

    public final static AtomicReferenceArrayUnserializer instance = new AtomicReferenceArrayUnserializer();

    @SuppressWarnings({"unchecked"})
    public AtomicReferenceArray read(Reader reader, int tag, Type type) throws IOException {
        if (tag == TagNull) return null;
        type = ClassUtil.getComponentType(type);
        Object[] array = (Object[])ArrayUnserializer.instance.read(reader, tag, type);
        return new AtomicReferenceArray(array);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy