/*
(non-Javadoc)

@see com.emc.ecs.nfsclient.nfs.NfsResponseBase#unmarshalling(com.emc.ecs.
nfsclient.rpc.Xdr)
18956
public void unmarshalling(Xdr xdr) throws RpcException {
        super.unmarshalling(xdr);
        unmarshallingAttributes(xdr);
        if (stateIsOk()) {
            _attributes = new NfsPosixAttributes();
            _attributes.unmarshalling(xdr);
        }
    }
515543
public void marshalling(Xdr xdr) {
        if ( !isBareTime() ) {
            xdr.putInt(_timeSettingType);
        }
        if ( captureTime() ) {
            xdr.putUnsignedInt(seconds);
            xdr.putUnsignedInt(nanoseconds);
        }
    }
1153562
public Object unmarshalRootElement(Node node, BaseXmlTrxMessageIn soapTrxMessage) throws Exception
    {
/*        try {
            // create a JAXBContext capable of handling classes generated into
            // the primer.po package
            String strSOAPPackage = (String)((TrxMessageHeader)soapTrxMessage.getMessage().getMessageHeader()).get(SOAPMessageTransport.SOAP_PACKAGE);
            if (strSOAPPackage != null)
            {
                Object obj = null;
                IUnmarshallingContext u = JibxContexts.getJAXBContexts().getUnmarshaller(strSOAPPackage);
                if (u == null)
                    return null;
                synchronized(u)
                {   // Since the marshaller is shared (may want to tweek this for multi-cpu implementations)
                    obj = u.unmarshalDocument( node );
                }

                return obj;
            }
//+        } catch (XMLStreamException ex)  {
//+            ex.printStackTrace();
        } catch (JiBXException ex)  {
            ex.printStackTrace();
        }
*/
        return super.unmarshalRootElement(node, soapTrxMessage);
    }
450838
public void marshalling(Xdr xdr) {
        super.marshalling(xdr);
        _attributes.marshalling(xdr);
        if (_guardTime == null) {
            xdr.putBoolean(false);
        } else {
            xdr.putBoolean(true);
            _guardTime.marshalling(xdr);
        }
    }
619002
public static <T> T unmarshal(Class<T> cl, Reader r) throws JAXBException {
    return unmarshal(cl, new StreamSource(r));
  }
1247162
public Object unmarshalRootElement(Node node, BaseXmlTrxMessageIn soapTrxMessage) throws Exception
    {
            // Override this! (If you can!)
        TransformerFactory tFact = TransformerFactory.newInstance();

        Source source = new DOMSource(node);
        Writer writer = new StringWriter();
        Result result = new StreamResult(writer);

        Transformer transformer = tFact.newTransformer();
        transformer.transform(source, result);

        writer.flush();
        writer.close();
        String strXMLBody = writer.toString();
        
        Reader inStream = new StringReader(strXMLBody);

        Object msg = this.unmarshalRootElement(inStream, soapTrxMessage);

        inStream.close();
        
        return msg;        
    }
1198440
static Xdr removeRecordMarking(byte[] bytes) {
        Xdr toReturn = new Xdr(bytes.length);
        Xdr input = new Xdr(bytes);

        long fragSize;
        boolean lastFragment = false;

        input.setOffset(0);
        int inputOff = input.getOffset();

        while (!lastFragment) {

            fragSize = input.getUnsignedInt();
            lastFragment = isLastFragment(fragSize);
            fragSize = maskFragmentSize(fragSize);

            toReturn.putBytes(input.getBuffer(), input.getOffset(), (int) fragSize);
            inputOff += fragSize;
            input.setOffset(inputOff);
        }

        // get xid
        int off = toReturn.getOffset();
        toReturn.setOffset(0);
        int xid = toReturn.getInt();
        toReturn.setXid(xid);
        toReturn.setOffset(off);

        return toReturn;
    }
149768
public void marshalling(Xdr xdr) {
        super.marshalling(xdr);
        xdr.putString(_name);
        xdr.putInt(_createMode.getValue());
        if (_createMode != NfsCreateMode.EXCLUSIVE) {
            _attributes.marshalling(xdr);
        } else {
            xdr.putByteArray(_verifier);
        }
    }
1217000
public void unmarshalling(Xdr xdr) {
        _loaded = true;
        _type = NfsType.fromValue((int) xdr.getUnsignedInt());
        _mode = xdr.getUnsignedInt();
        _nlink = xdr.getUnsignedInt();
        _uid = xdr.getUnsignedInt();
        _gid = xdr.getUnsignedInt();
        _size = xdr.getLong();
        _used = xdr.getLong();
        _rdev[0] = xdr.getUnsignedInt();
        _rdev[1] = xdr.getUnsignedInt();
        _fsid = xdr.getLong();
        _fileid = xdr.getLong();
        _atime = new NfsTime();
        _mtime = new NfsTime();
        _ctime = new NfsTime();
        _atime.unmarshalling(xdr);
        _mtime.unmarshalling(xdr);
        _ctime.unmarshalling(xdr);
    }
1339693
public static <T> List<T> unmarshalCollection(Class<T> cl, Reader r) throws JAXBException {
    return unmarshalCollection(cl, new StreamSource(r));
  }
737041
@Nonnull
  private static Configuration _unmarshallConfiguration (@WillClose @Nonnull final InputStream aIS)
  {
    ValueEnforcer.notNull (aIS, "InputStream");

    try
    {
      final JAXBContext ctx = JAXBContextCache.getInstance ()
                                              .getFromCache (com.helger.holiday.jaxb.ObjectFactory.class);
      final Unmarshaller um = ctx.createUnmarshaller ();
      final JAXBElement <Configuration> aElement = GenericReflection.uncheckedCast (um.unmarshal (aIS));
      return aElement.getValue ();
    }
    catch (final JAXBException ex)
    {
      throw new IllegalArgumentException ("Cannot parse holidays XML.", ex);
    }
    finally
    {
      StreamHelper.close (aIS);
    }
  }
948513
public void unmarshalling(Xdr xdr) throws RpcException {
        super.unmarshalling(xdr);
        unmarshallingAttributes(xdr);
        if (stateIsOk()) {
            _fsStat = new NfsFsStat(xdr);
        }
    }
1349178
@Override
    public Entry<String, NotificationConfiguration> unmarshall(StaxUnmarshallerContext context) throws Exception {
        int originalDepth = context.getCurrentDepth();
        int targetDepth = originalDepth + 1;

        if (context.isStartOfDocument()) {
            targetDepth += 1;
        }

        T topicConfig = createConfiguration();
        String id = null;

        while (true) {
            XMLEvent xmlEvent = context.nextEvent();
            if (xmlEvent.isEndDocument()) {
                return new SimpleEntry<String, NotificationConfiguration>(id, topicConfig);
            }

            if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) {
                if (handleXmlEvent(topicConfig, context, targetDepth)) {
                    // Do nothing, subclass has handled it
                } else if (context.testExpression("Id", targetDepth)) {
                    id = StringStaxUnmarshaller.getInstance().unmarshall(context);
                } else if (context.testExpression("Event", targetDepth)) {
                    topicConfig.addEvent(StringStaxUnmarshaller.getInstance().unmarshall(context));
                } else if (context.testExpression("Filter", targetDepth)) {
                    topicConfig.setFilter(FilterStaxUnmarshaller.getInstance().unmarshall(context));
                }
            } else if (xmlEvent.isEndElement()) {
                if (context.getCurrentDepth() < originalDepth) {
                    return new SimpleEntry<String, NotificationConfiguration>(id, topicConfig);
                }
            }
        }
    }
1126679
public void unmarshalling(Xdr xdr) throws RpcException {
        super.unmarshalling(xdr);
        unmarshallingAttributes(xdr);
        if (stateIsOk()) {
            _cookieverf = xdr.getLong();

            // get directory entries
            while (xdr.getBoolean()) {
                NfsDirectoryEntry entry = new NfsDirectoryEntry(xdr);
                _entries.add(entry);
                _cookie = entry.getCookie();
            }

            // check whether it is the end of directory
            _eof = xdr.getBoolean();
        }
    }
549739
protected static NfsGetAttributes makeNfsGetAttributes(Xdr xdr, boolean force) {
        NfsGetAttributes attributes = null;
        if (force || xdr.getBoolean()) {
            attributes = new NfsGetAttributes();
            attributes.unmarshalling(xdr);
        }
        return attributes;
    }
1092961
public List<T> unmarshall(JsonUnmarshallerContext context) throws Exception {
        if (context.isInsideResponseHeader()) {
            return unmarshallResponseHeaderToList(context);
        }
        return unmarshallJsonToList(context);
    }
460248
public void marshalling(Xdr xdr) {
        marshalling(xdr, _mode);
        marshalling(xdr, _uid);
        marshalling(xdr, _gid);
        if (_size != null) {
            xdr.putBoolean(true);
            xdr.putLong(_size.longValue());
        } else {
            xdr.putBoolean(false);
        }
        marshalling(xdr, _atime);
        marshalling(xdr, _mtime);
    }