nvp = new BasicNameValuePair(in.readString(), in.readString());
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); } }
/** * 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; } }
/** * 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; } }
String name = readString(false); Enum en = null; Class cl = desc.forClass();
String name = readString(false); Enum en = null; Class cl = desc.forClass();
return checkResolve(readString(unshared));
return checkResolve(readString(unshared));