public PageNavigationalState unserialize(InputStream in) throws IOException, IllegalArgumentException
{
DataInputStream data = in instanceof DataInputStream ? (DataInputStream)in : new DataInputStream(in);
//
PageNavigationalState pageNS = new PageNavigationalState(true);
//
int size = data.readInt();
while (size-- > 0)
{
String windowId = data.readUTF();
byte header = data.readByte();
StateString portletNS = null;
if ((header & 1) != 0)
{
portletNS = StateString.create(data);
}
org.gatein.pc.api.WindowState windowState = null;
int windowStateHeader = (header & (7 << 1)) >> 1;
switch (windowStateHeader)
{
case 0:
break;
case 4:
windowState = org.gatein.pc.api.WindowState.create(data.readUTF());
break;
default:
windowState = codeToWindowState.get(windowStateHeader);
}
org.gatein.pc.api.Mode mode = null;
int modeStateHeader = (header & (7 << (1 + 3))) >> (1 + 3);
switch (modeStateHeader)
{
case 0:
break;
case 4:
mode = Mode.create(data.readUTF());
break;
default:
mode = codeToMode.get(modeStateHeader);
}
WindowNavigationalState windowNS = new WindowNavigationalState(portletNS, mode, windowState);
pageNS.setWindowNavigationalState(windowId, windowNS);
}
//
size = data.readInt();
while (size-- > 0)
{
String namespaceURI = data.readUTF();
String localName = data.readUTF();
QName name = new QName(namespaceURI, localName);
int length = data.readInt();
String[] values = new String[length];
for (int i = 0; i < length; i++)
{
values[i] = data.readUTF();
}
pageNS.setPublicNavigationalState(name, values);
}
//
return pageNS;
}