package com.lutao.cloud.iot.mqtt.codec;

import java.nio.ByteBuffer;

/**
 * ByteBufAllocator
 *

 */
public enum ByteBufferAllocator {

	/**
	 * 堆内存
	 */
	HEAP() {
		@Override
		public ByteBuffer allocate(int capacity) {
			return ByteBuffer.allocate(capacity);
		}
	},

	/**
	 * 直接内存
	 */
	DIRECT() {
		@Override
		public ByteBuffer allocate(int capacity) {
			return ByteBuffer.allocateDirect(capacity);
		}
	};

	public abstract ByteBuffer allocate(int capacity);

}
