本文整理匯總了Java中java.io.DataInput.readByte方法的典型用法代碼示例。如果您正苦於以下問題:Java DataInput.readByte方法的具體用法?Java DataInput.readByte怎麽用?Java DataInput.readByte使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.io.DataInput
的用法示例。
在下文中一共展示了DataInput.readByte方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: readFields
import java.io.DataInput; //導入方法依賴的package包/類
@Override
public void readFields(DataInput in) throws IOException {
// Get the number of "unknown" classes
newClasses = in.readByte();
// Then read in the class names and add them to our tables
for (int i = 0; i < newClasses; i++) {
byte id = in.readByte();
String className = in.readUTF();
try {
addToMap(Class.forName(className), id);
} catch (ClassNotFoundException e) {
throw new IOException("can't find class: " + className + " because "+
e.getMessage());
}
}
}
示例2: fromData
import java.io.DataInput; //導入方法依賴的package包/類
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
this.entryBits = in.readByte();
byte flags = in.readByte();
this.key = DataSerializer.readObject(in);
if (EntryBits.isTombstone(this.entryBits)) {
this.value = Token.TOMBSTONE;
} else {
this.value = DataSerializer.readByteArray(in);
}
this.lastModified = in.readLong();
if ((flags & HAS_VERSION) != 0) {
// note that null IDs must be later replaced with the image provider's ID
this.versionTag = VersionTag.create((flags & PERSISTENT_VERSION) != 0, in);
}
}
示例3: fromData
import java.io.DataInput; //導入方法依賴的package包/類
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
this.name = in.readUTF();
this.expression = in.readUTF();
this.fromClause = in.readUTF();
this.loadEntries = in.readBoolean();
byte byteIndexType = in.readByte();
if (0 == byteIndexType) {
this.indexType = IndexType.PRIMARY_KEY;
} else if (1 == byteIndexType) {
this.indexType = IndexType.HASH;
} else {
this.indexType = IndexType.FUNCTIONAL;
}
boolean isImportStr = in.readBoolean();
if (isImportStr) {
this.importStr = in.readUTF();
}
}
示例4: fromData
import java.io.DataInput; //導入方法依賴的package包/類
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
byte flags = in.readByte();
final boolean hasVersionTag;
if ((hasVersionTag = (flags & VALUE_HAS_VERSION_TAG) != 0)) {
flags &= ~VALUE_HAS_VERSION_TAG;
}
this.valueType = flags;
this.valueInBytes = DataSerializer.readByteArray(in);
if (flags != VALUE_IS_BYTES) {
this.remoteVersion = InternalDataSerializer.getVersionForDataStreamOrNull(in);
}
if (hasVersionTag) {
this.versionTag = (VersionTag) DataSerializer.readObject(in);
}
}
示例5: fromData
import java.io.DataInput; //導入方法依賴的package包/類
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
byte flag = in.readByte();
if (flag != NO_PARTITION) {
this.configuredMaxMemory = in.readLong();
this.size = in.readLong();
this.bucketCount = in.readInt();
this.primaryCount = in.readInt();
if (flag == OK_INTERNAL) {
this.prLoad = PRLoad.createFromDataInput(in);
this.bucketSizes = DataSerializer.readLongArray(in);
this.offlineDetails = new OfflineMemberDetailsImpl();
InternalDataSerializer.invokeFromData(this.offlineDetails, in);
}
}
}
示例6: getZoneInfo
import java.io.DataInput; //導入方法依賴的package包/類
public static ZoneInfo getZoneInfo(DataInput in, String zoneId) throws Exception {
byte type = in.readByte();
// TBD: assert ZRULES:
int stdSize = in.readInt();
long[] stdTrans = new long[stdSize];
for (int i = 0; i < stdSize; i++) {
stdTrans[i] = readEpochSec(in);
}
int [] stdOffsets = new int[stdSize + 1];
for (int i = 0; i < stdOffsets.length; i++) {
stdOffsets[i] = readOffset(in);
}
int savSize = in.readInt();
long[] savTrans = new long[savSize];
for (int i = 0; i < savSize; i++) {
savTrans[i] = readEpochSec(in);
}
int[] savOffsets = new int[savSize + 1];
for (int i = 0; i < savOffsets.length; i++) {
savOffsets[i] = readOffset(in);
}
int ruleSize = in.readByte();
ZoneOffsetTransitionRule[] rules = new ZoneOffsetTransitionRule[ruleSize];
for (int i = 0; i < ruleSize; i++) {
rules[i] = new ZoneOffsetTransitionRule(in);
}
return getZoneInfo(zoneId, stdTrans, stdOffsets, savTrans, savOffsets, rules);
}
示例7: PutAllEntryData
import java.io.DataInput; //導入方法依賴的package包/類
/**
* Constructor to use when receiving a putall from someone else
*/
public PutAllEntryData(DataInput in, EventID baseEventID, int idx, Version version,
ByteArrayDataInput bytesIn) throws IOException, ClassNotFoundException {
this.key = DataSerializer.readObject(in);
byte flgs = in.readByte();
if ((flgs & IS_OBJECT) != 0) {
this.value = DataSerializer.readObject(in);
} else {
byte[] bb = DataSerializer.readByteArray(in);
if ((flgs & IS_CACHED_DESER) != 0) {
this.value = CachedDeserializableFactory.create(bb);
} else {
this.value = bb;
}
}
this.oldValue = null;
this.op = Operation.fromOrdinal(in.readByte());
this.flags = in.readByte();
if ((this.flags & FILTER_ROUTING) != 0) {
this.filterRouting = (FilterRoutingInfo) DataSerializer.readObject(in);
}
if ((this.flags & VERSION_TAG) != 0) {
boolean persistentTag = (this.flags & PERSISTENT_TAG) != 0;
this.versionTag = VersionTag.create(persistentTag, in);
}
if (isUsedFakeEventId()) {
this.eventID = new EventID();
InternalDataSerializer.invokeFromData(this.eventID, in);
} else {
this.eventID = new EventID(baseEventID, idx);
}
if ((this.flags & HAS_TAILKEY) != 0) {
this.tailKey = DataSerializer.readLong(in);
}
this.opInfo = DataSerializer.readObject(in);
}
示例8: readFields
import java.io.DataInput; //導入方法依賴的package包/類
@Override
public void readFields(DataInput in, Model m) throws IOException {
isRecurrent = in.readBoolean();
if(in.readBoolean()) relativeRid = (int) in.readByte();
if(in.readBoolean()) absoluteRid = (int) in.readByte();
rangeMatch = Relation.read(in, m);
rangeOutput = Output.read(in, m);
}
示例9: fromData
import java.io.DataInput; //導入方法依賴的package包/類
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
this.grantorVersion = in.readLong();
this.dlsSerialNumber = in.readInt();
this.serviceName = DataSerializer.readString(in);
this.processorId = in.readInt();
this.opCode = in.readByte();
if (this.opCode == BECOME_OP) {
this.oldTurk = (InternalDistributedMember) DataSerializer.readObject(in);
}
}
示例10: readUnsignedVarInt
import java.io.DataInput; //導入方法依賴的package包/類
/**
* @throws IllegalArgumentException if variable-length value does not terminate
* after 5 bytes have been read
* @throws IOException if {@link DataInput} throws {@link IOException}
* @see #readUnsignedVarLong(DataInput)
*/
public static int readUnsignedVarInt(DataInput in) throws IOException {
int value = 0;
int i = 0;
int b;
while (((b = in.readByte()) & 0x80) != 0) {
value |= (b & 0x7F) << i;
i += 7;
if (i > 35) {
throw new IllegalArgumentException("Variable length quantity is too long");
}
}
return value | (b << i);
}
示例11: newDataInput
import java.io.DataInput; //導入方法依賴的package包/類
/**
* Creates a new {@link NormalizedNodeDataInput} instance that reads from the given input. This method first reads
* and validates that the input contains a valid NormalizedNode stream.
*
* @param input the DataInput to read from
* @return a new {@link NormalizedNodeDataInput} instance
* @throws IOException if an error occurs reading from the input
*/
public static NormalizedNodeDataInput newDataInput(@Nonnull final DataInput input) throws IOException {
final byte marker = input.readByte();
if (marker != TokenTypes.SIGNATURE_MARKER) {
throw new InvalidNormalizedNodeStreamException(String.format("Invalid signature marker: %d", marker));
}
final short version = input.readShort();
switch (version) {
case TokenTypes.LITHIUM_VERSION:
return new NormalizedNodeInputStreamReader(input, true);
default:
throw new InvalidNormalizedNodeStreamException(String.format("Unhandled stream version %s", version));
}
}
示例12: readType
import java.io.DataInput; //導入方法依賴的package包/類
private static byte readType(DataInput input, NBTSizeTracker sizeTracker) throws IOException
{
return input.readByte();
}
示例13: fromData
import java.io.DataInput; //導入方法依賴的package包/類
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
this.responseCode = in.readByte();
}
示例14: fromData
import java.io.DataInput; //導入方法依賴的package包/類
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
long l;
if (in == null) {
throw new NullPointerException("Null DataInput");
}
this.hasKeys = in.readBoolean();
this.index = in.readInt();
this.typeArray = new byte[index];
this.keyArray = new Object[index];
this.objectArray = new Object[index];
byte objectType;
Object value;
int length;
byte[] bytes;
for (int i = 0; i < this.index; i++) {
if (this.hasKeys) {
length = in.readByte();
bytes = new byte[length];
in.readFully(bytes, 0, length);
this.keyArray[i] = bytes;
}
objectType = in.readByte();
if (objectType == BYTES) {
length = in.readShort();
if (length >= 0) {
bytes = new byte[length];
in.readFully(bytes, 0, length);
} else {
bytes = null;
}
value = bytes;
} else if (objectType == OBJECT) {
value = DataSerializer.readObject(in);
} else if (objectType == EXCEPTION) {
byte[] exBytes = DataSerializer.readByteArray(in);
value = CacheServerHelper.deserialize(exBytes);
// ignore the exception string meant for native clients
DataSerializer.readString(in);
} else {
value = null;
}
this.objectArray[i] = value;
}
}
示例15: readInterestResultPolicy
import java.io.DataInput; //導入方法依賴的package包/類
/**
* Reads an instance of <code>InterestResultPolicy</code> from a <code>DataInput</code>.
*
* @throws IOException A problem occurs while reading from <code>in</code>
*/
private static InterestResultPolicyImpl readInterestResultPolicy(DataInput in)
throws IOException, ClassNotFoundException {
byte ordinal = in.readByte();
return (InterestResultPolicyImpl) InterestResultPolicy.fromOrdinal(ordinal);
}