本文整理汇总了Java中java.io.DataInput.readChar方法的典型用法代码示例。如果您正苦于以下问题:Java DataInput.readChar方法的具体用法?Java DataInput.readChar怎么用?Java DataInput.readChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.DataInput
的用法示例。
在下文中一共展示了DataInput.readChar方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readCharArray
import java.io.DataInput; //导入方法依赖的package包/类
/**
* Reads an array of <code>char</code>s from a <code>DataInput</code>.
*
* @throws IOException A problem occurs while reading from <code>in</code>
*
* @see #writeCharArray
* @since GemFire 5.7
*/
public static char[] readCharArray(DataInput in) throws IOException {
InternalDataSerializer.checkIn(in);
int length = InternalDataSerializer.readArrayLength(in);
if (length == -1) {
return null;
} else {
char[] array = new char[length];
for (int i = 0; i < length; i++) {
array[i] = in.readChar();
}
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
logger.trace(LogMarker.SERIALIZER, "Read char array of length {}", length);
}
return array;
}
}
示例2: read
import java.io.DataInput; //导入方法依赖的package包/类
@Override
public void read(DataInput stream) throws Exception{
char[] chars = new char[stream.readInt()];
for(int i = 0; i < chars.length; i++){
chars[i] = stream.readChar();
}
this.data = new String(chars);
}
示例3: readPrimitiveChar
import java.io.DataInput; //导入方法依赖的package包/类
/**
* Reads a primitive <code>char</code> from a <code>DataInput</code>.
*
* @throws IOException A problem occurs while reading from <code>in</code>
* @see DataInput#readChar
* @since GemFire 5.1
*/
public static char readPrimitiveChar(DataInput in) throws IOException {
InternalDataSerializer.checkIn(in);
char value = in.readChar();
if (logger.isTraceEnabled(LogMarker.SERIALIZER)) {
logger.trace(LogMarker.SERIALIZER, "Read Char {}", value);
}
return value;
}
示例4: readCharArray
import java.io.DataInput; //导入方法依赖的package包/类
private void readCharArray(DataInput in) throws IOException {
char[] v = (char[]) value;
for (int i = 0; i < length; i++)
v[i] = in.readChar();
}
示例5: readStream
import java.io.DataInput; //导入方法依赖的package包/类
@Override
public Character readStream(final DataInput data)
throws IOException
{
return data.readChar();
}
示例6: read
import java.io.DataInput; //导入方法依赖的package包/类
/** Read ArithmeticProgression from DataInput */
private static ArithmeticProgression read(DataInput in) throws IOException {
return new ArithmeticProgression(in.readChar(),
in.readLong(), in.readLong(), in.readLong());
}