本文整理匯總了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());
}