private void expand(int amount) {
    if (disallowExpansion) {
      if (expansionException != null) {
        ignoreWrites = true;
        buffer.position(memoPosition);
        throw expansionException;
      } else {
        throw new IllegalStateException("initial buffer size was exceeded");
      }
    }

    final ByteBuffer oldBuffer = buffer;
    if (chunks == null) {
      chunks = new LinkedList<>();
    }
    oldBuffer.flip(); // now ready for reading
    size += oldBuffer.remaining();
    chunks.add(oldBuffer);
    if (amount < MIN_CHUNK_SIZE) {
      amount = MIN_CHUNK_SIZE;
    }
    buffer = ByteBuffer.allocate(amount);
  }
write the low-order 8 bits of the given int
geode-serialization/src/main/java/org/apache/geode/internal/serialization/BufferDataOutputStream.java