當前位置: 首頁>>代碼示例>>Java>>正文


Java Input類代碼示例

本文整理匯總了Java中com.esotericsoftware.kryo.io.Input的典型用法代碼示例。如果您正苦於以下問題:Java Input類的具體用法?Java Input怎麽用?Java Input使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Input類屬於com.esotericsoftware.kryo.io包,在下文中一共展示了Input類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: read

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
@Override
public MapMetaData<Integer> read(Kryo kryo, Input input, Class<MapMetaData<Integer>> type) {
    try {
        thatMapMetaData = mapMetaData.recv(input);
        int thatMapSegNum = thatMapMetaData.getSegNum();
        List<Map<String, Integer>> mapDataList = new ArrayList<>(thatMapSegNum);
        thatMapMetaData.setMapDataList(mapDataList);

        for (int i = 0; i < thatMapSegNum; i++) {
            int dataNum = thatMapMetaData.getDataNum(i);
            Map<String, Integer> mapData = new HashMap<>(dataNum);
            mapDataList.add(mapData);
            for (int j = 0; j < dataNum; j++) {
                String key = input.readString();
                Integer val = input.readInt();
                mapData.put(key, val);
            }
        }
    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatMapMetaData;
}
 
開發者ID:yuantiku,項目名稱:ytk-mp4j,代碼行數:25,代碼來源:IntOperand.java

示例2: read

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
public ArrayMetaData<long[]> read(Kryo kryo, Input input, Class<ArrayMetaData<long[]>> type) {
    try {
        long[] arrData = arrayMetaData.getArrData();
        thatArrMetaData = arrayMetaData.recv(input);
        int arrSegNum = thatArrMetaData.getSegNum();
        for (int i = 0; i < arrSegNum; i++) {
            int from = thatArrMetaData.getFrom(i);
            int to = thatArrMetaData.getTo(i);
            for (int j = from; j < to; j++) {
                arrData[j] = operator.apply(arrData[j], input.readLong());
            }
        }
        thatArrMetaData.setArrData(arrData);
    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatArrMetaData;
}
 
開發者ID:yuantiku,項目名稱:ytk-mp4j,代碼行數:20,代碼來源:LongOperand.java

示例3: read

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
public ArrayMetaData<short[]> read(Kryo kryo, Input input, Class<ArrayMetaData<short[]>> type) {
    try {
        short[] arrData = arrayMetaData.getArrData();
        thatArrMetaData = arrayMetaData.recv(input);
        int arrSegNum = thatArrMetaData.getSegNum();
        for (int i = 0; i < arrSegNum; i++) {
            int from = thatArrMetaData.getFrom(i);
            int to = thatArrMetaData.getTo(i);
            for (int j = from; j < to; j++) {
                arrData[j] = operator.apply(arrData[j], input.readShort());
            }
        }
        thatArrMetaData.setArrData(arrData);
    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatArrMetaData;
}
 
開發者ID:yuantiku,項目名稱:ytk-mp4j,代碼行數:20,代碼來源:ShortOperand.java

示例4: createService

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
@Override
protected GoogleAccountsService createService(final Kryo kryo, final Input input, final String id,
        final String originalUrl, final String artifactId) {

    final String requestId = kryo.readObject(input, String.class);
    final String relayState = kryo.readObject(input, String.class);
    try {
        return (GoogleAccountsService) CONSTRUCTOR.newInstance(
                id,
                originalUrl,
                artifactId,
                relayState,
                requestId,
                privateKey,
                publicKey,
                alternateUsername);
    } catch (final Exception e) {
        throw new IllegalStateException("Error creating SamlService", e);
    }
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:21,代碼來源:GoogleAccountsServiceSerializer.java

示例5: read

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
@Override
public Instructions.ExtensionInstructionWrapper read(Kryo kryo, Input input,
                                                     Class<Instructions.ExtensionInstructionWrapper> type) {
    ExtensionTreatmentType exType = (ExtensionTreatmentType) kryo.readClassAndObject(input);
    DeviceId deviceId = (DeviceId) kryo.readClassAndObject(input);

    DriverService driverService = DefaultServiceDirectory.getService(DriverService.class);
    DriverHandler handler = new DefaultDriverHandler(
            new DefaultDriverData(driverService.getDriver(deviceId), deviceId));

    ExtensionTreatmentResolver resolver = handler.behaviour(ExtensionTreatmentResolver.class);
    ExtensionTreatment instruction = resolver.getExtensionInstruction(exType);

    byte[] bytes = (byte[]) kryo.readClassAndObject(input);

    instruction.deserialize(bytes);

    return Instructions.extension(instruction, deviceId);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:20,代碼來源:ExtensionInstructionSerializer.java

示例6: createService

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
@Override
protected GoogleAccountsService createService(final Kryo kryo, final Input input, final String id,
        final String originalUrl, final String artifactId) {

    final String requestId = kryo.readObject(input, String.class);
    final String relayState = kryo.readObject(input, String.class);
    try {
        return (GoogleAccountsService) CONSTRUCTOR.newInstance(
                id,
                originalUrl,
                artifactId,
                relayState,
                requestId,
                this.privateKey,
                this.publicKey,
                this.alternateUsername);
    } catch (final Exception e) {
        throw new IllegalStateException("Error creating SamlService", e);
    }
}
 
開發者ID:mrluo735,項目名稱:cas-5.1.0,代碼行數:21,代碼來源:GoogleAccountsServiceSerializer.java

示例7: read

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
@Override
public Bmv2DeviceContext read(Kryo kryo, Input input, Class<Bmv2DeviceContext> type) {
    String jsonStr = kryo.readObject(input, String.class);
    String interpreterClassName = kryo.readObject(input, String.class);
    Bmv2Configuration configuration = parse(Json.parse(jsonStr).asObject());
    ClassLoader loader = interpreterClassLoaders.get(interpreterClassName);
    if (loader == null) {
        throw new IllegalStateException("No class loader registered for interpreter: " + interpreterClassName);
    }
    try {
        Bmv2Interpreter interpreter = (Bmv2Interpreter) loader.loadClass(interpreterClassName).newInstance();
        return new Bmv2DeviceContext(configuration, interpreter);
    } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
        throw new RuntimeException("Unable to load interpreter class", e);
    }
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:17,代碼來源:Bmv2DeviceContextServiceImpl.java

示例8: read

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
@Override
public ExtensionCriterion read(Kryo kryo, Input input,
        Class<ExtensionCriterion> type) {
    ExtensionSelectorType exType = (ExtensionSelectorType) kryo.readClassAndObject(input);
    DeviceId deviceId = (DeviceId) kryo.readClassAndObject(input);

    DriverService driverService = DefaultServiceDirectory.getService(DriverService.class);
    DriverHandler handler = new DefaultDriverHandler(
            new DefaultDriverData(driverService.getDriver(deviceId), deviceId));

    ExtensionSelectorResolver resolver = handler.behaviour(ExtensionSelectorResolver.class);
    ExtensionSelector selector = resolver.getExtensionSelector(exType);

    byte[] bytes = (byte[]) kryo.readClassAndObject(input);
    selector.deserialize(bytes);
    return Criteria.extension(selector, deviceId);
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:18,代碼來源:ExtensionCriterionSerializer.java

示例9: decode

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
@Override
public Object decode(ByteBuf buf, State state) throws IOException {
    Kryo kryo = null;
    try {
        kryo = kryoPool.get();
        return kryo.readClassAndObject(new Input(new ByteBufInputStream(buf)));
    } catch (Exception e) {
        if (e instanceof RuntimeException) {
            throw (RuntimeException) e;
        }
        throw new RedissonKryoCodecException(e);
    } finally {
        if (kryo != null) {
            kryoPool.yield(kryo);
        }
    }
}
 
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:18,代碼來源:KryoCodec.java

示例10: read

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
@Override
public T read(Kryo kryo, Input input, Class<T> type) {
    int length = input.readVarInt(true);
    boolean ordered = input.readBoolean();
    Class cls = kryo.readClass(input).getType();
    T array = create(ordered, length, cls);
    kryo.reference(array);
    Class elementClass = null;
    Serializer serializer = null;
    if (genericType != null) {
        elementClass = genericType;
        serializer = kryo.getSerializer(genericType);
        genericType = null;
    }
    if (serializer != null) {
        for (int i = 0; i < length; i++)
            array.add(kryo.readObjectOrNull(input, elementClass, serializer));
    } else {
        for (int i = 0; i < length; i++)
            array.add(kryo.readClassAndObject(input));
    }
    return array;
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:24,代碼來源:ArraySerializer.java

示例11: read

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
public ArrayMetaData<byte[]> read(Kryo kryo, Input input, Class<ArrayMetaData<byte[]>> type) {
    try {
        byte[] arrData = arrayMetaData.getArrData();
        thatArrMetaData = arrayMetaData.recv(input);
        int arrSegNum = thatArrMetaData.getSegNum();
        for (int i = 0; i < arrSegNum; i++) {
            int from = thatArrMetaData.getFrom(i);
            int to = thatArrMetaData.getTo(i);
            for (int j = from; j < to; j++) {
                arrData[j] = input.readByte();
            }
        }
        thatArrMetaData.setArrData(arrData);
    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatArrMetaData;

}
 
開發者ID:yuantiku,項目名稱:ytk-mp4j,代碼行數:21,代碼來源:ByteOperand.java

示例12: read

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
public ArrayMetaData<String[]> read(Kryo kryo, Input input, Class<ArrayMetaData<String[]>> type) {
    try {
        String[] arrData = arrayMetaData.getArrData();
        thatArrMetaData = arrayMetaData.recv(input);
        int arrSegNum = thatArrMetaData.getSegNum();
        for (int i = 0; i < arrSegNum; i++) {
            int from = thatArrMetaData.getFrom(i);
            int to = thatArrMetaData.getTo(i);
            for (int j = from; j < to; j++) {
                arrData[j] = input.readString();
            }
        }
        thatArrMetaData.setArrData(arrData);
    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatArrMetaData;

}
 
開發者ID:yuantiku,項目名稱:ytk-mp4j,代碼行數:21,代碼來源:StringOperand.java

示例13: read

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
@Override
public final void read (Kryo kryo, Input input) {
    pushHeader(kryo, this);
    input.readInt(true); //if this class ever evolves, version can be used for backward compatibility
    Class dataType = kryo.readClass(input).getType();
    gdxMajorVersion = input.readInt(true);
    gdxMinorVersion = input.readInt(true);
    gdxRevisionVersion = input.readInt(true);
    writtenVersion = input.readInt(true);
    minimumReadVersion = input.readInt(true);
    minimumReadVersionString = input.readString();
    useCompactColor = input.readBoolean();
    includePixmapDrawingParams = input.readBoolean();
    readExtra(kryo, input);
    if (dataType != null && minimumReadVersion <= currentReadWriteVersion){
        data = (T)kryo.readObject(input, dataType);
    }
    popHeader(kryo);
}
 
開發者ID:CypherCove,項目名稱:gdx-cclibs,代碼行數:20,代碼來源:GraphHeader.java

示例14: read

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
@Override
public IpPrefix read(Kryo kryo, Input input,
        Class<IpPrefix> type) {
    int octLen = input.readInt();
    checkArgument(octLen <= IpAddress.INET6_BYTE_LENGTH);
    byte[] octs = new byte[octLen];
    input.readBytes(octs);
    int prefLen = input.readInt();
    // Use the address size to decide whether it is IPv4 or IPv6 address
    if (octLen == IpAddress.INET_BYTE_LENGTH) {
        return IpPrefix.valueOf(IpAddress.Version.INET, octs, prefLen);
    }
    if (octLen == IpAddress.INET6_BYTE_LENGTH) {
        return IpPrefix.valueOf(IpAddress.Version.INET6, octs, prefLen);
    }
    return null;    // Shouldn't be reached
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:18,代碼來源:IpPrefixSerializer.java

示例15: readFromBytes

import com.esotericsoftware.kryo.io.Input; //導入依賴的package包/類
public T[] readFromBytes(Object origin, Input input, int slaveNum) {
    T[] originArr = (T[])origin;
    Kryo kryo = KryoUtils.getKryo();
    for (int i = 0; i < slaveNum; i++) {
        if (i == 0) {
            for (int j = 0; j < originArr.length; j++) {
                originArr[j] = (T)serializer.read(kryo, input, type);
            }
        } else {
            for (int j = 0; j < originArr.length; j++) {
                T readed = (T)serializer.read(kryo, input, type);
                originArr[j] = operator.apply(originArr[j], readed);
            }
        }
    }
    return originArr;
}
 
開發者ID:yuantiku,項目名稱:ytk-mp4j,代碼行數:18,代碼來源:ObjectOperand.java


注:本文中的com.esotericsoftware.kryo.io.Input類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。