• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java BufferInput类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中io.atomix.catalyst.buffer.BufferInput的典型用法代码示例。如果您正苦于以下问题:Java BufferInput类的具体用法?Java BufferInput怎么用?Java BufferInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

BufferInput类属于io.atomix.catalyst.buffer包,在下文中一共展示了BufferInput类的35个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: readObject

点赞 3

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput buffer, Serializer serializer) {
  status = Status.forId(buffer.readByte());
  if (status == Status.OK) {
    error = null;
    index = buffer.readLong();
    term = buffer.readLong();
    timestamp = buffer.readLong();
    members = serializer.readObject(buffer);
  } else {
    int errorCode = buffer.readByte();
    if (errorCode != 0) {
      error = CopycatError.forId(errorCode);
    }
  }
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:17,
代码来源:ConfigurationResponse.java

示例2: readReference

点赞 3

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
/**
 * Reads an object reference.
 *
 * @param type The reference type.
 * @param buffer The reference buffer.
 * @param serializer The serializer with which the object is being read.
 * @return The reference to read.
 */
@SuppressWarnings("unchecked")
private T readReference(Class<T> type, BufferInput<?> buffer, Serializer serializer) {
  ReferencePool<?> pool = pools.get(type);
  if (pool == null) {
    Constructor<?> constructor = constructorMap.get(type);
    if (constructor == null) {
      try {
        constructor = type.getDeclaredConstructor(ReferenceManager.class);
        constructor.setAccessible(true);
        constructorMap.put(type, constructor);
      } catch (NoSuchMethodException e) {
        throw new SerializationException("failed to instantiate reference: must provide a single argument constructor", e);
      }
    }

    pool = new ReferencePool<>(createFactory(constructor));
    pools.put(type, pool);
  }
  T object = (T) pool.acquire();
  object.readObject(buffer, serializer);
  return object;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:31,
代码来源:CatalystSerializableSerializer.java

示例3: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
    super.readObject(buffer, serializer);
    key = serializer.readObject(buffer);
    value = serializer.readObject(buffer);

}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:8,
代码来源:AsyncConsistentMultimapCommands.java

示例4: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
    super.readObject(buffer, serializer);
    key = serializer.readObject(buffer);
    value = serializer.readObject(buffer);
    valueMatch = serializer.readObject(buffer);
    versionMatch = serializer.readObject(buffer);
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:9,
代码来源:AtomixConsistentMapCommands.java

示例5: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public T read(Class<T> type, BufferInput buffer,
        io.atomix.catalyst.serializer.Serializer serializer) {
    int size = buffer.readInt();
    try {
        byte[] payload = new byte[size];
        buffer.read(payload);
        return this.serializer.decode(payload);
    } catch (Exception e) {
        log.warn("Failed to deserialize as type {}. Payload size: {}", type, size, e);
        Throwables.propagate(e);
        return null;
    }
}
 

开发者ID:shlee89,
项目名称:athena,
代码行数:15,
代码来源:DefaultCatalystTypeSerializerFactory.java

示例6: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
  status = Status.forId(buffer.readByte());
  if (status == Status.OK) {
    error = null;
    session = buffer.readLong();
    timeout = buffer.readLong();
    leader = serializer.readObject(buffer);
    members = serializer.readObject(buffer);
  } else {
    error = CopycatError.forId(buffer.readByte());
    session = 0;
    members = null;
  }
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:16,
代码来源:RegisterResponse.java

示例7: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
  status = Status.forId(buffer.readByte());
  if (status == Status.OK) {
    error = null;
    leader = serializer.readObject(buffer);
    members = serializer.readObject(buffer);
  } else {
    error = CopycatError.forId(buffer.readByte());
  }
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:12,
代码来源:ConnectResponse.java

示例8: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
  status = Status.forId(buffer.readByte());
  if (status == Status.OK) {
    error = null;
  } else {
    error = CopycatError.forId(buffer.readByte());
  }
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:10,
代码来源:UnregisterResponse.java

示例9: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
  status = Status.forId(buffer.readByte());
  index = buffer.readLong();
  eventIndex = buffer.readLong();
  if (status == Status.OK) {
    error = null;
    result = serializer.readObject(buffer);
  } else {
    error = CopycatError.forId(buffer.readByte());
    lastSequence = buffer.readLong();
  }
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:14,
代码来源:OperationResponse.java

示例10: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
  super.readObject(buffer, serializer);
  eventIndex = buffer.readLong();
  previousIndex = buffer.readLong();

  events.clear();
  int size = buffer.readUnsignedShort();
  for (int i = 0; i < size; i++) {
    events.add(serializer.readObject(buffer));
  }
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:13,
代码来源:PublishRequest.java

示例11: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
  status = Status.forId(buffer.readByte());
  if (status == Status.OK) {
    error = null;
    leader = serializer.readObject(buffer);
    members = serializer.readObject(buffer);
  } else {
    error = CopycatError.forId(buffer.readByte());
    leader = serializer.readObject(buffer);
  }
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:13,
代码来源:KeepAliveResponse.java

示例12: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput buffer, Serializer serializer) {
  status = Response.Status.forId(buffer.readByte());
  if (status == Response.Status.OK) {
    error = null;
    term = buffer.readLong();
    voted = buffer.readBoolean();
  } else {
    error = CopycatError.forId(buffer.readByte());
  }
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:12,
代码来源:VoteResponse.java

示例13: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput buffer, Serializer serializer) {
  status = Response.Status.forId(buffer.readByte());
  if (status == Response.Status.OK) {
    error = null;
    term = buffer.readLong();
    accepted = buffer.readBoolean();
  } else {
    error = CopycatError.forId(buffer.readByte());
  }
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:12,
代码来源:PollResponse.java

示例14: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
  term = buffer.readLong();
  candidate = buffer.readInt();
  logIndex = buffer.readLong();
  logTerm = buffer.readLong();
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:8,
代码来源:PollRequest.java

示例15: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
  term = buffer.readLong();
  leader = buffer.readInt();
  index = buffer.readLong();
  offset = buffer.readInt();
  complete = buffer.readBoolean();
  data = serializer.<byte[]>readObject(buffer);
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:10,
代码来源:InstallRequest.java

示例16: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput buffer, Serializer serializer) {
  status = Status.forId(buffer.readByte());
  if (status == Status.OK) {
    error = null;
  } else {
    error = CopycatError.forId(buffer.readByte());
  }
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:10,
代码来源:InstallResponse.java

示例17: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
  term = buffer.readLong();
  leader = buffer.readInt();
  index = buffer.readLong();
  timestamp = buffer.readLong();
  members = serializer.readObject(buffer);
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:9,
代码来源:ConfigureRequest.java

示例18: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput buffer, Serializer serializer) {
  status = Status.forId(buffer.readByte());
  if (status == Response.Status.OK) {
    error = null;
    term = buffer.readLong();
    succeeded = buffer.readBoolean();
    logIndex = buffer.readLong();
  } else {
    error = CopycatError.forId(buffer.readByte());
  }
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:13,
代码来源:AppendResponse.java

示例19: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
  type = Member.Type.values()[buffer.readByte()];
  status = Status.values()[buffer.readByte()];
  updated = Instant.ofEpochMilli(buffer.readLong());
  serverAddress = serializer.readObject(buffer);
  clientAddress = serializer.readObject(buffer);
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:9,
代码来源:ServerMember.java

示例20: readObject

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public void readObject(BufferInput<?> buffer, Serializer serializer) {
  setTerm(buffer.readLong());
  compaction = Compaction.Mode.values()[buffer.readByte()];
  paddingSize = buffer.readInt();
  padding = new byte[paddingSize];
  buffer.read(padding);
}
 

开发者ID:atomix,
项目名称:copycat,
代码行数:9,
代码来源:TestEntry.java

示例21: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public char[] read(Class<char[]> type, BufferInput buffer, Serializer serializer) {
  char[] chars = new char[buffer.readUnsignedShort()];
  for (int i = 0; i < chars.length; i++) {
    chars[i] = buffer.readChar();
  }
  return chars;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:9,
代码来源:CharacterArraySerializer.java

示例22: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public int[] read(Class<int[]> type, BufferInput buffer, Serializer serializer) {
  int[] ints = new int[buffer.readUnsignedShort()];
  for (int i = 0; i < ints.length; i++) {
    ints[i] = buffer.readInt();
  }
  return ints;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:9,
代码来源:IntegerArraySerializer.java

示例23: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public float[] read(Class<float[]> type, BufferInput buffer, Serializer serializer) {
  float[] floats = new float[buffer.readUnsignedShort()];
  for (int i = 0; i < floats.length; i++) {
    floats[i] = buffer.readFloat();
  }
  return floats;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:9,
代码来源:FloatArraySerializer.java

示例24: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public long[] read(Class<long[]> type, BufferInput buffer, Serializer serializer) {
  long[] longs = new long[buffer.readUnsignedShort()];
  for (int i = 0; i < longs.length; i++) {
    longs[i] = buffer.readLong();
  }
  return longs;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:9,
代码来源:LongArraySerializer.java

示例25: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public boolean[] read(Class<boolean[]> type, BufferInput buffer, Serializer serializer) {
  boolean[] booleans = new boolean[buffer.readUnsignedShort()];
  for (int i = 0; i < booleans.length; i++) {
    booleans[i] = buffer.readBoolean();
  }
  return booleans;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:9,
代码来源:BooleanArraySerializer.java

示例26: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public double[] read(Class<double[]> type, BufferInput buffer, Serializer serializer) {
  double[] doubles = new double[buffer.readUnsignedShort()];
  for (int i = 0; i < doubles.length; i++) {
    doubles[i] = buffer.readDouble();
  }
  return doubles;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:9,
代码来源:DoubleArraySerializer.java

示例27: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public short[] read(Class<short[]> type, BufferInput buffer, Serializer serializer) {
  short[] shorts = new short[buffer.readUnsignedShort()];
  for (int i = 0; i < shorts.length; i++) {
    shorts[i] = buffer.readShort();
  }
  return shorts;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:9,
代码来源:ShortArraySerializer.java

示例28: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public Class<?> read(Class<Class<?>> type, BufferInput buffer, Serializer serializer) {
  try {
    String className = buffer.readUTF8();
    return serializer.getClassLoader(className).loadClass(className);
  } catch (ClassNotFoundException e) {
    throw new SerializationException(e);
  }
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:10,
代码来源:ClassSerializer.java

示例29: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public T read(Class<T> type, BufferInput buffer, Serializer serializer) {
  int size = buffer.readUnsignedShort();
  T object = createList(size);
  for (int i = 0; i < size; i++) {
    object.add(serializer.readObject(buffer));
  }
  return object;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:11,
代码来源:ListSerializer.java

示例30: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Map.Entry<?, ?> read(Class<Map.Entry<?, ?>> type, BufferInput buffer, Serializer serializer) {
  Object key = serializer.readObject(buffer);
  Object value = serializer.readObject(buffer);
  return new MapEntry<>(key, value);
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:8,
代码来源:MapEntrySerializer.java

示例31: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public T read(Class<T> type, BufferInput buffer, Serializer serializer) {
  int size = buffer.readUnsignedShort();
  T object = createMap(size);
  for (int i = 0; i < size; i++) {
    Object key = serializer.readObject(buffer);
    Object value = serializer.readObject(buffer);
    object.put(key, value);
  }
  return object;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:13,
代码来源:MapSerializer.java

示例32: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public T read(Class<T> type, BufferInput buffer, Serializer serializer) {
  int size = buffer.readUnsignedShort();
  T object = createSet(size);
  for (int i = 0; i < size; i++) {
    object.add(serializer.readObject(buffer));
  }
  return object;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:11,
代码来源:SetSerializer.java

示例33: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public T read(Class<T> type, BufferInput buffer, Serializer serializer) {
  if (ReferenceCounted.class.isAssignableFrom(type)) {
    return readReference(type, buffer, serializer);
  } else {
    return readObject(type, buffer, serializer);
  }
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:9,
代码来源:CatalystSerializableSerializer.java

示例34: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public TestPojoWithSerializer read(Class<TestPojoWithSerializer> type, BufferInput buffer, Serializer serializer) {
  TestPojoWithSerializer object = new TestPojoWithSerializer();
  object.primitive = buffer.readLong();
  object.object = serializer.readObject(buffer);
  object.string = buffer.readUTF8();
  return object;
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:9,
代码来源:SerializerTest.java

示例35: read

点赞 2

import io.atomix.catalyst.buffer.BufferInput; //导入依赖的package包/类
@Override
public Object read(Class type, BufferInput buffer, Serializer serializer) {
  try {
    return mapper.readValue(new BufferInputStream(buffer), type);
  } catch (IOException e) {
    throw new SerializationException(e);
  }
}
 

开发者ID:atomix,
项目名称:catalyst,
代码行数:9,
代码来源:GenericJacksonSerializer.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)