MCPcopy Create free account
hub / github.com/akeranen/the-one / getFreeBufferSize

Method getFreeBufferSize

routing/MessageRouter.java:264–276  ·  view source on GitHub ↗

Returns the amount of free space in the buffer. May return a negative value if there are more messages in the buffer than should fit there (because of creating new messages). @return The amount of free space (Integer.MAX_VALUE if the buffer size isn't defined)

()

Source from the content-addressed store, hash-verified

262 * size isn't defined)
263 */
264 public int getFreeBufferSize() {
265 int occupancy = 0;
266
267 if (this.getBufferSize() == Integer.MAX_VALUE) {
268 return Integer.MAX_VALUE;
269 }
270
271 for (Message m : getMessageCollection()) {
272 occupancy += m.getSize();
273 }
274
275 return this.getBufferSize() - occupancy;
276 }
277
278 /**
279 * Returns the host this router is in

Callers 3

getBufferOccupancyMethod · 0.80
makeRoomForMessageMethod · 0.80
updateMethod · 0.80

Calls 3

getBufferSizeMethod · 0.95
getMessageCollectionMethod · 0.95
getSizeMethod · 0.80

Tested by

no test coverage detected