MCPcopy Create free account
hub / github.com/boazy/TWEditorEnhanced / encodeList

Method encodeList

src/main/java/Database.java:825–849  ·  view source on GitHub ↗
(DBElement element)

Source from the content-addressed store, hash-verified

823 }
824
825 private int encodeList(DBElement element)
826 throws DBException
827 {
828 DBList list = (DBList)element.getValue();
829 int listCount = list.getElementCount();
830 int listLength = (listCount + 1) * 4;
831 if (this.listIndicesLength + listLength > this.listIndicesSize) {
832 int increment = Math.max(listLength, 2000);
833 this.listIndicesSize += increment;
834 byte[] buffer = new byte[this.listIndicesSize];
835 System.arraycopy(this.listIndicesBuffer, 0, buffer, 0, this.listIndicesLength);
836 this.listIndicesBuffer = buffer;
837 }
838
839 int listOffset = this.listIndicesLength;
840 this.listIndicesLength += listLength;
841 setInteger(listCount, this.listIndicesBuffer, listOffset);
842
843 for (int i = 0; i < listCount; i++) {
844 int structIndex = encodeStruct(list.getElement(i));
845 setInteger(structIndex, this.listIndicesBuffer, listOffset + 4 * (i + 1));
846 }
847
848 return listOffset;
849 }
850
851 private int setFieldData(byte[] data)
852 {

Callers 1

encodeFieldMethod · 0.95

Calls 5

getElementCountMethod · 0.95
setIntegerMethod · 0.95
encodeStructMethod · 0.95
getElementMethod · 0.95
getValueMethod · 0.45

Tested by

no test coverage detected