Copyright (C) 2013-2015 Regents of the University of California.
- Jeff Thompson <firstname.lastname@example.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
A copy of the GNU Lesser General Public License is in the file COPYING.
A ElementReader lets you call onReceivedData multiple times which
uses a BinaryXmlStructureDecoder or TlvStructureDecoder to detect the end of
a binary XML or NDN-TLV element and calls
elementListener.onReceivedElement(element) with the element. This handles the
case where a single call to onReceivedData may contain multiple elements.
Create a new ElementReader with the elementListener.
elementListener The ElementListener used by onReceivedData.
Continue to read data until the end of an element, then call
elementListener.onReceivedElement(element ). The buffer passed to
onReceivedElement is only valid during this call. If you need the data
later, you must copy.
data The input data containing bytes of the element to read.
This reads from position() to limit(), but does not change the position.
EncodingException For invalid encoding.
int firstByte = (int)data.get(0) & 0xff;
("The incoming packet exceeds the maximum limit Face.getMaxNdnPacketSize()");