Returns the number of bytes overhead of the {@link OggPage}
we belong to, if we're the only packet in the page, or
a rough guess if we span multiple pages / share a page.
776923
public int getOverheadBytes() {
        if (parent == null) return 0;

        double ourShare = 1.0;
        int ourDataLen = getData().length;
        int pageDataLen = parent.getDataSize();
        if (pageDataLen != ourDataLen) {
            // We don't have a page to ourselves, so we can't come up
            //  with a fully accurate overhead at this stage, so get close

            // Do we span multiple pages?
            if (ourDataLen > pageDataLen) {
                // Take a best guess, rounding up
                int approxPages = (int)Math.ceil(ourDataLen/pageDataLen);
                ourShare = approxPages;
            } else {
                // We're probably just a part of a larger page
                // Take a rough guess
                ourShare = ((double)ourDataLen) / pageDataLen;
            }
        }
        // Take the current page's overhead, scale as needed, and return
        return (int)Math.rint(ourShare * (parent.getPageSize() - pageDataLen));
    }
656623
final int getSize() {
        if (classReaderOffset != 0) {
            return 6 + classReaderLength;
        }
        int size = 8;
        if (code.length > 0) {
            if (code.length > 65536) {
                throw new RuntimeException("Method code too large!");
            }
            cw.newUTF8("Code");
            size += 18 + code.length + 8 * handlerCount;
            if (localVar != null) {
                cw.newUTF8("LocalVariableTable");
                size += 8 + localVar.length;
            }
            if (localVarType != null) {
                cw.newUTF8("LocalVariableTypeTable");
                size += 8 + localVarType.length;
            }
            if (lineNumber != null) {
                cw.newUTF8("LineNumberTable");
                size += 8 + lineNumber.length;
            }
            if (stackMap != null) {
                boolean zip = (cw.version & 0xFFFF) >= Opcodes.V1_6;
                cw.newUTF8(zip ? "StackMapTable" : "StackMap");
                size += 8 + stackMap.length;
            }
            if (ClassReader.ANNOTATIONS && ctanns != null) {
                cw.newUTF8("RuntimeVisibleTypeAnnotations");
                size += 8 + ctanns.getSize();
            }
            if (ClassReader.ANNOTATIONS && ictanns != null) {
                cw.newUTF8("RuntimeInvisibleTypeAnnotations");
                size += 8 + ictanns.getSize();
            }
            if (cattrs != null) {
                size += cattrs.getSize(cw, code.data, code.length, maxStack,
                        maxLocals);
            }
        }
        if (exceptionCount > 0) {
            cw.newUTF8("Exceptions");
            size += 8 + 2 * exceptionCount;
        }
        if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
            if ((cw.version & 0xFFFF) < Opcodes.V1_5
                    || (access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) != 0) {
                cw.newUTF8("Synthetic");
                size += 6;
            }
        }
        if ((access & Opcodes.ACC_DEPRECATED) != 0) {
            cw.newUTF8("Deprecated");
            size += 6;
        }
        if (ClassReader.SIGNATURES && signature != null) {
            cw.newUTF8("Signature");
            cw.newUTF8(signature);
            size += 8;
        }
        if (methodParameters != null) {
            cw.newUTF8("MethodParameters");
            size += 7 + methodParameters.length;
        }
        if (ClassReader.ANNOTATIONS && annd != null) {
            cw.newUTF8("AnnotationDefault");
            size += 6 + annd.length;
        }
        if (ClassReader.ANNOTATIONS && anns != null) {
            cw.newUTF8("RuntimeVisibleAnnotations");
            size += 8 + anns.getSize();
        }
        if (ClassReader.ANNOTATIONS && ianns != null) {
            cw.newUTF8("RuntimeInvisibleAnnotations");
            size += 8 + ianns.getSize();
        }
        if (ClassReader.ANNOTATIONS && tanns != null) {
            cw.newUTF8("RuntimeVisibleTypeAnnotations");
            size += 8 + tanns.getSize();
        }
        if (ClassReader.ANNOTATIONS && itanns != null) {
            cw.newUTF8("RuntimeInvisibleTypeAnnotations");
            size += 8 + itanns.getSize();
        }
        if (ClassReader.ANNOTATIONS && panns != null) {
            cw.newUTF8("RuntimeVisibleParameterAnnotations");
            size += 7 + 2 * (panns.length - synthetics);
            for (int i = panns.length - 1; i >= synthetics; --i) {
                size += panns[i] == null ? 0 : panns[i].getSize();
            }
        }
        if (ClassReader.ANNOTATIONS && ipanns != null) {
            cw.newUTF8("RuntimeInvisibleParameterAnnotations");
            size += 7 + 2 * (ipanns.length - synthetics);
            for (int i = ipanns.length - 1; i >= synthetics; --i) {
                size += ipanns[i] == null ? 0 : ipanns[i].getSize();
            }
        }
        if (attrs != null) {
            size += attrs.getSize(cw, null, 0, -1, -1);
        }
        return size;
    }
585245
private long getSize() {
		long numSegments = 0;
		numSegments += this.availableMemory.size();
		numSegments += this.buckets.length;
		for(InMemoryPartition<T> p : this.partitions) {
			numSegments += p.getBlockCount();
			numSegments += p.numOverflowSegments;
		}
		numSegments += this.compactionMemory.getBlockCount();
		return numSegments*this.segmentSize;
	}
444128
public void bufferPacket(OggPacket packet, long granulePosition) {
        if(closed) {
            throw new IllegalStateException("Can't buffer packets on a closed stream!");
        }
        if(! doneFirstPacket) {
            packet.setIsBOS();
            doneFirstPacket = true;
        }

        int size = packet.getData().length;
        boolean emptyPacket = (size==0);

        // Add to pages in turn
        OggPage page = getCurrentPage(false);
        int pos = 0;
        while( pos < size || emptyPacket) {
            pos = page.addPacket(packet, pos);
            if(pos < size) {
                page = getCurrentPage(true);
                page.setIsContinuation();
            }
            page.setGranulePosition(granulePosition);
            emptyPacket = false;
        }
        currentGranulePosition = granulePosition;
        packet.setParent(page);
    }
854109
def get_paging(self):
        
        orig_page_num = self.page_num
        orig_page_size = self.page_size

        try:

            page_num = int(self.request.GET.get(self.page_kwarg or 'p'))

            if page_num < 1:
                page_num = orig_page_num
        except:
            page_num = orig_page_num

        try:
            orig_page_size = self.page_size
            page_size = int(self.request.GET.get(self.page_size_kwarg or 'ps'))

            if page_size < 1:
                page_size = orig_page_size
        except:
            page_size = orig_page_size

        return page_num, page_size
985716
public long getSize() {
        long elementSize = dumpClass.getHprof().getValueSize(getType());

        return dumpClass.classDumpSegment.getMinimumInstanceSize() + HPROF_ARRAY_OVERHEAD + (elementSize * getLength());
    }
1160884
public static int getDefaultPageSize() {
        synchronized (sLock) {
            if (sDefaultPageSize == 0) {
                try {
                    Class clazz = Class.forName("android.os.StatFs");
                    Method m = clazz.getMethod("getBlockSize");
                    Object statFsObj = clazz.getConstructor(String.class).newInstance("/data");
                    Integer value = (Integer) m.invoke(statFsObj, (Object[])null);
                    if (value != null)
                        return value.intValue();
                } catch (Exception e) { }
            }
            if (sDefaultPageSize == 0)
                sDefaultPageSize = 1024;
            return sDefaultPageSize;
        }
    }
914453
private final int calcSize () {

        int size = BasicHeaderSegment.BHS_FIXED_SIZE;
        size += basicHeaderSegment.getTotalAHSLength() * AdditionalHeaderSegment.AHS_FACTOR;

        // plus the sizes of the used digests
        size += headerDigest.getSize();
        size += dataDigest.getSize();

        size += AbstractDataSegment.getTotalLength(basicHeaderSegment.getDataSegmentLength());

        return size;
    }
1303808
int guessPayloadLength() {
    int length = 0;
    // It is likely that the String length will be the same as the length in bytes
    // when it has been encoded (to UTF8) plus a small overhead.
    try {
      if (jmo.getPayloadPart().getChoiceField(JsPayloadAccess.PAYLOAD) != JsPayloadAccess.IS_PAYLOAD_EMPTY) {
        String payload = (String)getPayload().getField(JmsTextBodyAccess.BODY_DATA_VALUE);
        if (payload != null) length = payload.length() + 24;
      }
    }
    catch (MFPUnsupportedEncodingRuntimeException e) {
      FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsJmsTextMessageImpl.getText", "129");
      // hmm... how do we figure out a reasonable length
    }
    return length;
  }
860901
private long getIPv4Count(boolean excludeZeroHosts, int segCount) {
		if(!isMultiple()) {
			if(excludeZeroHosts && isZero()) {
				return 0L;
			}
			return 1L;
		}
		long result = getCount(i -> getSegment(i).getValueCount(), segCount);
		if(excludeZeroHosts && includesZeroHost()) {
			int prefixedSegment = getNetworkSegmentIndex(getNetworkPrefixLength(), IPv4Address.BYTES_PER_SEGMENT, IPv4Address.BITS_PER_SEGMENT);
			long zeroHostCount = getCount(i -> {
				if(i == prefixedSegment) {
					IPAddressSegment seg = getSegment(i);
					int shift = seg.getBitCount() - seg.getSegmentPrefixLength();
					int count = ((seg.getUpperSegmentValue() >>> shift) - (seg.getSegmentValue() >>> shift)) + 1;
					return count;
				}
				return getSegment(i).getValueCount();
			}, prefixedSegment + 1);
			result -= zeroHostCount;
		}
		return result;
	}
418194
private byte getFlagByte()
	{
		byte ret = 0;

		if (unsynchronisation) ret |= 0x80;
		if (extended) ret |= 0x40;
		if (experimental) ret |= 0x20;
		if (footer) ret |= 0x10;

		return ret;
	}
1037335
public int getDocumentsPerPage() {
    try {
      final int perPage = _jsonObject.getJSONObject(META_OBJECT_FIELD).getInt("per_page");
      return perPage;
    } catch (JSONException ex) {
      throw new QuandlRuntimeException("Could not find total_count field in results from Quandl", ex);
    }
  }
188469
public long sizeInBytes() throws IOException {
        long memoryBlockUsage = 0;
        for (StreamBlock b : m_memoryDeque) {
            //Use only total size, but throw in the USO
            //to make book keeping consistent when flushed to disk
            //Also dont count persisted blocks.
            memoryBlockUsage += b.totalSize();
        }
        //Subtract USO from on disk size
        return memoryBlockUsage + m_reader.sizeInBytes() - (StreamBlock.HEADER_SIZE * m_reader.getNumObjects());
    }
724898
@Override
  public P readPage(int pageID) {
    try {
      countRead();
      long offset = ((long) (header.getReservedPages() + pageID)) * (long) pageSize;
      byte[] buffer = new byte[pageSize];
      file.seek(offset);
      file.read(buffer);
      return byteArrayToPage(buffer);
    }
    catch(IOException e) {
      throw new RuntimeException("IOException occurred during reading of page " + pageID + "\n", e);
    }
  }
449115
synchronized PageWrapper getRootPage() {
        return this.pageByOffset.values().stream()
                                .filter(page -> page.getParent() == null)
                                .findFirst().orElse(null);
    }
11645
int guessPayloadLength() {
    int length = 0;
    // Total guess at average size of map entry
    try {
      Map<String,Object> payload = getBodyMap();
      length = payload.size()*60;
    }
    catch (UnsupportedEncodingException e) {
      // No FFDC code needed
      // hmm... how do we figure out a reasonable length
    }
    return length;
  }
744464
public static long getSize(byte[] byteSize) {
	if (byteSize.length!=4) {
		return 0;
	}
	ByteBuffer converterBuffer = ByteBuffer.wrap(byteSize);
	converterBuffer.order(ByteOrder.LITTLE_ENDIAN);
	return convertSignedIntToUnsigned(converterBuffer.getInt());
}