public static BinaryResponse fromByteBuffer(ByteBuffer buffer) { BinaryRequestType requestType = BinaryRequestType.getByCode(buffer.get()); BinaryErrorCodes errorCode = BinaryErrorCodes.getByCode(buffer.get()); int sku = buffer.getInt(); short store = buffer.getShort(); int amount = buffer.getInt(); return new BinaryResponse(requestType, errorCode, sku, store, amount); }