本文整理了Java中java.io.ObjectInputStream.readString()
方法的一些代码示例,展示了ObjectInputStream.readString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectInputStream.readString()
方法的具体详情如下:
包路径:java.io.ObjectInputStream
类名称:ObjectInputStream
方法名:readString
[英]Reads in and returns new string. Sets passHandle to new string's assigned handle.
[中]读入并返回新字符串。将passHandle设置为新字符串的指定句柄。
代码示例来源:origin: stackoverflow.com
nvp = new BasicNameValuePair(in.readString(), in.readString());
代码示例来源:origin: stackoverflow.com
public class MyClass {
private static final int CUR_VERSION = 5;
private String _value;
private void readObject(ObjectInputStream in) {
// first value is always the serial version:
int dataVersion = in.readInt();
if(dataVersion == CUR_VERSION) {
// _value is a String
_value = in.readString();
} else {
// in older versions, _value was an int
_value = String.valueOf(in.readInt());
}
}
private void writeObject(ObjectOutputStream out) {
// always write version first
out.writeInt(CUR_VERSION);
out.writeString(_value);
}
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
/**
* Reads string without allowing it to be replaced in stream. Called from
* within ObjectStreamClass.read().
*/
String readTypeString() throws IOException {
int oldHandle = passHandle;
try {
byte tc = bin.peekByte();
switch (tc) {
case TC_NULL:
return (String) readNull();
case TC_REFERENCE:
return (String) readHandle(false);
case TC_STRING:
case TC_LONGSTRING:
return readString(false);
default:
throw new StreamCorruptedException(
String.format("invalid type code: %02X", tc));
}
} finally {
passHandle = oldHandle;
}
}
代码示例来源:origin: jtulach/bck2brwsr
/**
* Reads string without allowing it to be replaced in stream. Called from
* within ObjectStreamClass.read().
*/
String readTypeString() throws IOException {
int oldHandle = passHandle;
try {
byte tc = bin.peekByte();
switch (tc) {
case TC_NULL:
return (String) readNull();
case TC_REFERENCE:
return (String) readHandle(false);
case TC_STRING:
case TC_LONGSTRING:
return readString(false);
default:
throw new StreamCorruptedException(
String.format("invalid type code: %02X", tc));
}
} finally {
passHandle = oldHandle;
}
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
String name = readString(false);
Enum en = null;
Class cl = desc.forClass();
代码示例来源:origin: jtulach/bck2brwsr
String name = readString(false);
Enum en = null;
Class cl = desc.forClass();
代码示例来源:origin: org.apidesign.bck2brwsr/emul
return checkResolve(readString(unshared));
代码示例来源:origin: jtulach/bck2brwsr
return checkResolve(readString(unshared));
内容来源于网络,如有侵权,请联系作者删除!